@alephium/powfi-sdk 0.0.1-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/README.md +4 -0
  2. package/clmm/artifacts/BitmapWord.ral.json +125 -0
  3. package/clmm/artifacts/BitmapWordDeployer.ral.json +31 -0
  4. package/clmm/artifacts/CreateConfig.ral.json +37 -0
  5. package/clmm/artifacts/CreateLiquidPool.ral.json +55 -0
  6. package/clmm/artifacts/DexAccount.ral.json +110 -0
  7. package/clmm/artifacts/LiquidityAmountsTest.ral.json +161 -0
  8. package/clmm/artifacts/LiquidityManagmentTest.ral.json +384 -0
  9. package/clmm/artifacts/Pool.ral.json +1530 -0
  10. package/clmm/artifacts/PoolConfig.ral.json +31 -0
  11. package/clmm/artifacts/PoolFactory.ral.json +300 -0
  12. package/clmm/artifacts/PoolRouterDemo.ral.json +49 -0
  13. package/clmm/artifacts/PoolUser.ral.json +89 -0
  14. package/clmm/artifacts/Position.ral.json +183 -0
  15. package/clmm/artifacts/PositionManager.ral.json +416 -0
  16. package/clmm/artifacts/SwapWithoutAccount.ral.json +46 -0
  17. package/clmm/artifacts/TestToken.ral.json +68 -0
  18. package/clmm/artifacts/Tick.ral.json +161 -0
  19. package/clmm/artifacts/TickBitmapTest.ral.json +220 -0
  20. package/clmm/artifacts/constants.ral.json +81 -0
  21. package/clmm/artifacts/structs.ral.json +335 -0
  22. package/clmm/artifacts/ts/BitmapWord.ts +337 -0
  23. package/clmm/artifacts/ts/BitmapWordDeployer.ts +164 -0
  24. package/clmm/artifacts/ts/DexAccount.ts +330 -0
  25. package/clmm/artifacts/ts/LiquidityAmountsTest.ts +464 -0
  26. package/clmm/artifacts/ts/LiquidityManagmentTest.ts +859 -0
  27. package/clmm/artifacts/ts/Pool.ts +2535 -0
  28. package/clmm/artifacts/ts/PoolConfig.ts +179 -0
  29. package/clmm/artifacts/ts/PoolFactory.ts +640 -0
  30. package/clmm/artifacts/ts/PoolUser.ts +237 -0
  31. package/clmm/artifacts/ts/Position.ts +440 -0
  32. package/clmm/artifacts/ts/PositionManager.ts +929 -0
  33. package/clmm/artifacts/ts/TestToken.ts +277 -0
  34. package/clmm/artifacts/ts/Tick.ts +351 -0
  35. package/clmm/artifacts/ts/TickBitmapTest.ts +512 -0
  36. package/clmm/artifacts/ts/constants.ts +17 -0
  37. package/clmm/artifacts/ts/contracts.ts +26 -0
  38. package/clmm/artifacts/ts/deployments.ts +160 -0
  39. package/clmm/artifacts/ts/index.ts +20 -0
  40. package/clmm/artifacts/ts/scripts.ts +76 -0
  41. package/clmm/artifacts/ts/types.ts +105 -0
  42. package/clmm/deployments/.deployments.devnet.json +350 -0
  43. package/clmm/deployments/.deployments.testnet.json +350 -0
  44. package/cpmm/artifacts/dex/DexAccount.ral.json +110 -0
  45. package/cpmm/artifacts/dex/Router.ral.json +361 -0
  46. package/cpmm/artifacts/dex/TokenPair.ral.json +512 -0
  47. package/cpmm/artifacts/dex/TokenPairFactory.ral.json +297 -0
  48. package/cpmm/artifacts/examples/ExampleOracleSimple.ral.json +192 -0
  49. package/cpmm/artifacts/examples/FeeCollectorFactoryImpl.ral.json +185 -0
  50. package/cpmm/artifacts/examples/FeeCollectorPerTokenPairImpl.ral.json +216 -0
  51. package/cpmm/artifacts/examples/FullMathTest.ral.json +123 -0
  52. package/cpmm/artifacts/scripts/AddLiquidity.ral.json +46 -0
  53. package/cpmm/artifacts/scripts/Burn.ral.json +31 -0
  54. package/cpmm/artifacts/scripts/CollectFee.ral.json +25 -0
  55. package/cpmm/artifacts/scripts/CreatePair.ral.json +37 -0
  56. package/cpmm/artifacts/scripts/CreatePairAndAddLiquidity.ral.json +43 -0
  57. package/cpmm/artifacts/scripts/EnableFeeCollector.ral.json +28 -0
  58. package/cpmm/artifacts/scripts/Mint.ral.json +34 -0
  59. package/cpmm/artifacts/scripts/RemoveLiquidity.ral.json +43 -0
  60. package/cpmm/artifacts/scripts/SetFeeCollectorFactory.ral.json +28 -0
  61. package/cpmm/artifacts/scripts/Swap.ral.json +46 -0
  62. package/cpmm/artifacts/scripts/SwapMaxIn.ral.json +46 -0
  63. package/cpmm/artifacts/scripts/SwapMinOut.ral.json +46 -0
  64. package/cpmm/artifacts/test/GetToken.ral.json +31 -0
  65. package/cpmm/artifacts/test/MathTest.ral.json +49 -0
  66. package/cpmm/artifacts/test/TestToken.ral.json +87 -0
  67. package/cpmm/artifacts/ts/DexAccount.ts +329 -0
  68. package/cpmm/artifacts/ts/ExampleOracleSimple.ts +383 -0
  69. package/cpmm/artifacts/ts/FeeCollectorFactoryImpl.ts +227 -0
  70. package/cpmm/artifacts/ts/FeeCollectorPerTokenPairImpl.ts +327 -0
  71. package/cpmm/artifacts/ts/FullMathTest.ts +251 -0
  72. package/cpmm/artifacts/ts/MathTest.ts +183 -0
  73. package/cpmm/artifacts/ts/Router.ts +554 -0
  74. package/cpmm/artifacts/ts/TestToken.ts +312 -0
  75. package/cpmm/artifacts/ts/TokenPair.ts +947 -0
  76. package/cpmm/artifacts/ts/TokenPairFactory.ts +501 -0
  77. package/cpmm/artifacts/ts/contracts.ts +26 -0
  78. package/cpmm/artifacts/ts/deployments.ts +109 -0
  79. package/cpmm/artifacts/ts/index.ts +16 -0
  80. package/cpmm/artifacts/ts/scripts.ts +142 -0
  81. package/cpmm/deployments/.deployments.devnet.json +77 -0
  82. package/cpmm/deployments/.deployments.testnet.json +79 -0
  83. package/lib/index.d.mts +8800 -0
  84. package/lib/index.d.ts +8800 -0
  85. package/lib/index.js +21769 -0
  86. package/lib/index.js.map +1 -0
  87. package/lib/index.mjs +22118 -0
  88. package/lib/index.mjs.map +1 -0
  89. package/package.json +80 -0
  90. package/src/clmm/clmm.ts +607 -0
  91. package/src/clmm/constants.ts +7 -0
  92. package/src/clmm/index.ts +6 -0
  93. package/src/clmm/liquidity.ts +163 -0
  94. package/src/clmm/pool.ts +154 -0
  95. package/src/clmm/tick.ts +335 -0
  96. package/src/clmm/types.ts +155 -0
  97. package/src/common/constants.ts +1 -0
  98. package/src/common/error.ts +46 -0
  99. package/src/common/index.ts +7 -0
  100. package/src/common/logger.ts +82 -0
  101. package/src/common/math.ts +88 -0
  102. package/src/common/numeric.ts +64 -0
  103. package/src/common/types.ts +49 -0
  104. package/src/common/utils.ts +3 -0
  105. package/src/cpmm/constants.ts +2 -0
  106. package/src/cpmm/cpmm.ts +631 -0
  107. package/src/cpmm/index.ts +3 -0
  108. package/src/cpmm/types.ts +113 -0
  109. package/src/index.ts +25 -0
  110. package/src/moduleBase.ts +64 -0
  111. package/src/staking/index.ts +4 -0
  112. package/src/staking/settings.ts +38 -0
  113. package/src/staking/staking.ts +277 -0
  114. package/src/staking/types.ts +15 -0
  115. package/src/staking/utils.ts +25 -0
  116. package/src/token/index.ts +1 -0
  117. package/src/token/token.ts +163 -0
  118. package/src/zeta.ts +105 -0
  119. package/staking/artifacts/AlphStakeAndLock.ral.json +31 -0
  120. package/staking/artifacts/AlphUnstakeVault.ral.json +151 -0
  121. package/staking/artifacts/XAlphStakeVault.ral.json +559 -0
  122. package/staking/artifacts/XAlphToken.ral.json +404 -0
  123. package/staking/artifacts/XAlphUnlockAndStartUnstake.ral.json +31 -0
  124. package/staking/artifacts/examples/GovernanceDemo.ral.json +282 -0
  125. package/staking/artifacts/examples/RewardSharingVault.ral.json +253 -0
  126. package/staking/artifacts/structs.ral.json +47 -0
  127. package/staking/artifacts/ts/AlphUnstakeVault.ts +354 -0
  128. package/staking/artifacts/ts/FullMathTest.ts +175 -0
  129. package/staking/artifacts/ts/GovernanceDemo.ts +726 -0
  130. package/staking/artifacts/ts/RewardSharingVault.ts +559 -0
  131. package/staking/artifacts/ts/TestDynamicArrayByteVec32.ts +431 -0
  132. package/staking/artifacts/ts/TestDynamicSortedArrayForU256.ts +516 -0
  133. package/staking/artifacts/ts/TestMerkleProof.ts +343 -0
  134. package/staking/artifacts/ts/XAlphStakeVault.ts +1120 -0
  135. package/staking/artifacts/ts/XAlphToken.ts +835 -0
  136. package/staking/artifacts/ts/contracts.ts +26 -0
  137. package/staking/artifacts/ts/deployments.ts +109 -0
  138. package/staking/artifacts/ts/index.ts +15 -0
  139. package/staking/artifacts/ts/scripts.ts +35 -0
  140. package/staking/artifacts/ts/types.ts +19 -0
  141. package/staking/artifacts/utils/FullMathTest.ral.json +57 -0
  142. package/staking/artifacts/utils/TestDynamicArrayByteVec32.ral.json +165 -0
  143. package/staking/artifacts/utils/TestDynamicSortedArrayForU256.ral.json +189 -0
  144. package/staking/artifacts/utils/TestMerkleProof.ral.json +134 -0
  145. package/staking/deployments/.deployments.devnet.json +77 -0
  146. package/staking/deployments/.deployments.testnet.json +78 -0
@@ -0,0 +1,361 @@
1
+ {
2
+ "version": "v4.2.5",
3
+ "name": "Router",
4
+ "bytecode": "0007405840b340ef4119416c41bd42060000060802403316000c2f7a4c041816010c2f4c031602160302160216012c16002d170616061603324c081606160534130e7b1602160602160316002c16012d170716071604347a4c04181607160232130d7b16071603020103070e03402fd3c2b1ca2116065634130c7b0c0e16000107170817070c0e16000108170a17091609160a16021603160416050000170c170b16017a1607160ba31608160ca31601160b160c0f0d1600010e170d160b160c160d0201030608021fd3b9fb57ea16055634130c7b160116001602a3160116020e0e1600010f170717061606160334130d7b1607160434130e7b16061607020000020502160c0e16000108170317020c0e1600010718170416011604414c03160216030216031602020103070b004029d364342a1916065634130c7b160016020003170817071343e516032c1709160916082c16091343e816072c2a2d170a160a16043413097b160116021603a316001601160516021603160a00060103070a004029d31937d61916065634130c7b16001602000317081707160716042c1343e82c160816042b1343e52c2d0d2a17091609160332130a7b160116021609a31600160116051602160916040006000306070040270c0e1600010718170616031606414c0f160116031604a31601160216040c0c160513060c160001104a0e160116031604a3160116020c160416050c13060c16000110",
5
+ "codeHash": "e1ef7a11988dd23f3815d376e474266e3e9f69c9ad289974b9c45ed4ad986a6d",
6
+ "fieldsSig": {
7
+ "names": [],
8
+ "types": [],
9
+ "isMutable": []
10
+ },
11
+ "eventsSig": [],
12
+ "functions": [
13
+ {
14
+ "name": "addLiquidity_",
15
+ "paramNames": [
16
+ "reserve0",
17
+ "reserve1",
18
+ "amount0Desired",
19
+ "amount1Desired",
20
+ "amount0Min",
21
+ "amount1Min"
22
+ ],
23
+ "paramTypes": [
24
+ "U256",
25
+ "U256",
26
+ "U256",
27
+ "U256",
28
+ "U256",
29
+ "U256"
30
+ ],
31
+ "paramIsMutable": [
32
+ false,
33
+ false,
34
+ false,
35
+ false,
36
+ false,
37
+ false
38
+ ],
39
+ "returnTypes": [
40
+ "U256",
41
+ "U256"
42
+ ]
43
+ },
44
+ {
45
+ "name": "addLiquidity",
46
+ "paramNames": [
47
+ "tokenPair",
48
+ "sender",
49
+ "amount0Desired",
50
+ "amount1Desired",
51
+ "amount0Min",
52
+ "amount1Min",
53
+ "deadline"
54
+ ],
55
+ "paramTypes": [
56
+ "TokenPair",
57
+ "Address",
58
+ "U256",
59
+ "U256",
60
+ "U256",
61
+ "U256",
62
+ "U256"
63
+ ],
64
+ "paramIsMutable": [
65
+ false,
66
+ false,
67
+ false,
68
+ false,
69
+ false,
70
+ false,
71
+ false
72
+ ],
73
+ "returnTypes": [
74
+ "U256",
75
+ "U256",
76
+ "U256"
77
+ ]
78
+ },
79
+ {
80
+ "name": "removeLiquidity",
81
+ "paramNames": [
82
+ "tokenPairId",
83
+ "sender",
84
+ "liquidity",
85
+ "amount0Min",
86
+ "amount1Min",
87
+ "deadline"
88
+ ],
89
+ "paramTypes": [
90
+ "ByteVec",
91
+ "Address",
92
+ "U256",
93
+ "U256",
94
+ "U256",
95
+ "U256"
96
+ ],
97
+ "paramIsMutable": [
98
+ false,
99
+ false,
100
+ false,
101
+ false,
102
+ false,
103
+ false
104
+ ],
105
+ "returnTypes": [
106
+ "U256",
107
+ "U256"
108
+ ]
109
+ },
110
+ {
111
+ "name": "getReserveInAndReserveOut",
112
+ "paramNames": [
113
+ "tokenPair",
114
+ "tokenInId"
115
+ ],
116
+ "paramTypes": [
117
+ "TokenPair",
118
+ "ByteVec"
119
+ ],
120
+ "paramIsMutable": [
121
+ false,
122
+ false
123
+ ],
124
+ "returnTypes": [
125
+ "U256",
126
+ "U256"
127
+ ]
128
+ },
129
+ {
130
+ "name": "swapExactTokenForToken",
131
+ "paramNames": [
132
+ "tokenPair",
133
+ "sender",
134
+ "tokenInId",
135
+ "amountIn",
136
+ "amountOutMin",
137
+ "to",
138
+ "deadline"
139
+ ],
140
+ "paramTypes": [
141
+ "TokenPair",
142
+ "Address",
143
+ "ByteVec",
144
+ "U256",
145
+ "U256",
146
+ "Address",
147
+ "U256"
148
+ ],
149
+ "paramIsMutable": [
150
+ false,
151
+ false,
152
+ false,
153
+ false,
154
+ false,
155
+ false,
156
+ false
157
+ ],
158
+ "returnTypes": []
159
+ },
160
+ {
161
+ "name": "swapTokenForExactToken",
162
+ "paramNames": [
163
+ "tokenPair",
164
+ "sender",
165
+ "tokenInId",
166
+ "amountInMax",
167
+ "amountOut",
168
+ "to",
169
+ "deadline"
170
+ ],
171
+ "paramTypes": [
172
+ "TokenPair",
173
+ "Address",
174
+ "ByteVec",
175
+ "U256",
176
+ "U256",
177
+ "Address",
178
+ "U256"
179
+ ],
180
+ "paramIsMutable": [
181
+ false,
182
+ false,
183
+ false,
184
+ false,
185
+ false,
186
+ false,
187
+ false
188
+ ],
189
+ "returnTypes": []
190
+ },
191
+ {
192
+ "name": "swap",
193
+ "paramNames": [
194
+ "tokenPair",
195
+ "sender",
196
+ "to",
197
+ "tokenInId",
198
+ "amountIn",
199
+ "amountOut"
200
+ ],
201
+ "paramTypes": [
202
+ "TokenPair",
203
+ "Address",
204
+ "Address",
205
+ "ByteVec",
206
+ "U256",
207
+ "U256"
208
+ ],
209
+ "paramIsMutable": [
210
+ false,
211
+ false,
212
+ false,
213
+ false,
214
+ false,
215
+ false
216
+ ],
217
+ "returnTypes": []
218
+ }
219
+ ],
220
+ "constants": [],
221
+ "enums": [
222
+ {
223
+ "name": "ErrorCodes",
224
+ "fields": [
225
+ {
226
+ "name": "ReserveOverflow",
227
+ "value": {
228
+ "type": "U256",
229
+ "value": "0"
230
+ }
231
+ },
232
+ {
233
+ "name": "InsufficientInitLiquidity",
234
+ "value": {
235
+ "type": "U256",
236
+ "value": "1"
237
+ }
238
+ },
239
+ {
240
+ "name": "InsufficientLiquidityMinted",
241
+ "value": {
242
+ "type": "U256",
243
+ "value": "2"
244
+ }
245
+ },
246
+ {
247
+ "name": "InsufficientLiquidityBurned",
248
+ "value": {
249
+ "type": "U256",
250
+ "value": "3"
251
+ }
252
+ },
253
+ {
254
+ "name": "InvalidToAddress",
255
+ "value": {
256
+ "type": "U256",
257
+ "value": "4"
258
+ }
259
+ },
260
+ {
261
+ "name": "InsufficientLiquidity",
262
+ "value": {
263
+ "type": "U256",
264
+ "value": "5"
265
+ }
266
+ },
267
+ {
268
+ "name": "InvalidTokenInId",
269
+ "value": {
270
+ "type": "U256",
271
+ "value": "6"
272
+ }
273
+ },
274
+ {
275
+ "name": "InvalidCalleeId",
276
+ "value": {
277
+ "type": "U256",
278
+ "value": "7"
279
+ }
280
+ },
281
+ {
282
+ "name": "InvalidK",
283
+ "value": {
284
+ "type": "U256",
285
+ "value": "8"
286
+ }
287
+ },
288
+ {
289
+ "name": "InsufficientOutputAmount",
290
+ "value": {
291
+ "type": "U256",
292
+ "value": "9"
293
+ }
294
+ },
295
+ {
296
+ "name": "InsufficientInputAmount",
297
+ "value": {
298
+ "type": "U256",
299
+ "value": "10"
300
+ }
301
+ },
302
+ {
303
+ "name": "IdenticalTokenIds",
304
+ "value": {
305
+ "type": "U256",
306
+ "value": "11"
307
+ }
308
+ },
309
+ {
310
+ "name": "Expired",
311
+ "value": {
312
+ "type": "U256",
313
+ "value": "12"
314
+ }
315
+ },
316
+ {
317
+ "name": "InsufficientToken0Amount",
318
+ "value": {
319
+ "type": "U256",
320
+ "value": "13"
321
+ }
322
+ },
323
+ {
324
+ "name": "InsufficientToken1Amount",
325
+ "value": {
326
+ "type": "U256",
327
+ "value": "14"
328
+ }
329
+ },
330
+ {
331
+ "name": "TokenNotExist",
332
+ "value": {
333
+ "type": "U256",
334
+ "value": "15"
335
+ }
336
+ },
337
+ {
338
+ "name": "InvalidCaller",
339
+ "value": {
340
+ "type": "U256",
341
+ "value": "16"
342
+ }
343
+ },
344
+ {
345
+ "name": "FeeCollectorNotEnabled",
346
+ "value": {
347
+ "type": "U256",
348
+ "value": "17"
349
+ }
350
+ },
351
+ {
352
+ "name": "InvalidAccount",
353
+ "value": {
354
+ "type": "U256",
355
+ "value": "18"
356
+ }
357
+ }
358
+ ]
359
+ }
360
+ ]
361
+ }