@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,859 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ import {
6
+ Address,
7
+ Contract,
8
+ ContractState,
9
+ TestContractResult,
10
+ HexString,
11
+ ContractFactory,
12
+ EventSubscribeOptions,
13
+ EventSubscription,
14
+ CallContractParams,
15
+ CallContractResult,
16
+ TestContractParams,
17
+ ContractEvent,
18
+ subscribeContractEvent,
19
+ subscribeContractEvents,
20
+ testMethod,
21
+ callMethod,
22
+ multicallMethods,
23
+ fetchContractState,
24
+ Asset,
25
+ ContractInstance,
26
+ getContractEventsCurrentCount,
27
+ TestContractParamsWithoutMaps,
28
+ TestContractResultWithoutMaps,
29
+ SignExecuteContractMethodParams,
30
+ SignExecuteScriptTxResult,
31
+ signExecuteMethod,
32
+ addStdIdToFields,
33
+ encodeContractFields,
34
+ Narrow,
35
+ } from "@alephium/web3";
36
+ import { default as LiquidityManagmentTestContractJson } from "../LiquidityManagmentTest.ral.json";
37
+ import { getContractByCodeHash, registerContract } from "./contracts";
38
+ import * as types from "./types";
39
+
40
+ // Custom types for the contract
41
+ export namespace LiquidityManagmentTestTypes {
42
+ export type Fields = {
43
+ parent: HexString;
44
+ };
45
+
46
+ export type State = ContractState<Fields>;
47
+
48
+ export interface CallMethodTable {
49
+ addLiquidity: {
50
+ params: CallContractParams<{
51
+ payer: Address;
52
+ p: types.ModifyLiquidityParams;
53
+ }>;
54
+ result: CallContractResult<[bigint, bigint, bigint, HexString]>;
55
+ };
56
+ getLiquidityForAmount0: {
57
+ params: CallContractParams<{
58
+ sqrtRatioAX96: bigint;
59
+ sqrtRatioBX96: bigint;
60
+ amount0: bigint;
61
+ }>;
62
+ result: CallContractResult<bigint>;
63
+ };
64
+ getLiquidityForAmount1: {
65
+ params: CallContractParams<{
66
+ sqrtRatioAX96: bigint;
67
+ sqrtRatioBX96: bigint;
68
+ amount1: bigint;
69
+ }>;
70
+ result: CallContractResult<bigint>;
71
+ };
72
+ getLiquidityForAmounts: {
73
+ params: CallContractParams<{
74
+ sqrtRatioX96: bigint;
75
+ sqrtRatioAX96: bigint;
76
+ sqrtRatioBX96: bigint;
77
+ amount0: bigint;
78
+ amount1: bigint;
79
+ }>;
80
+ result: CallContractResult<bigint>;
81
+ };
82
+ getAmount0ForLiquidity: {
83
+ params: CallContractParams<{
84
+ sqrtRatioAX96: bigint;
85
+ sqrtRatioBX96: bigint;
86
+ liquidity: bigint;
87
+ }>;
88
+ result: CallContractResult<bigint>;
89
+ };
90
+ mulDiv: {
91
+ params: CallContractParams<{ a: bigint; b: bigint; denominator: bigint }>;
92
+ result: CallContractResult<bigint>;
93
+ };
94
+ mulDivRoundingUp: {
95
+ params: CallContractParams<{ a: bigint; b: bigint; denominator: bigint }>;
96
+ result: CallContractResult<bigint>;
97
+ };
98
+ configPath: {
99
+ params: CallContractParams<{ configIndex_: bigint }>;
100
+ result: CallContractResult<HexString>;
101
+ };
102
+ poolPath: {
103
+ params: CallContractParams<{
104
+ factory: HexString;
105
+ tokens: HexString;
106
+ configIndex_: bigint;
107
+ }>;
108
+ result: CallContractResult<HexString>;
109
+ };
110
+ poolContractId: {
111
+ params: CallContractParams<{
112
+ factory: HexString;
113
+ tokens: HexString;
114
+ configIndex_: bigint;
115
+ }>;
116
+ result: CallContractResult<HexString>;
117
+ };
118
+ positionPath: {
119
+ params: CallContractParams<{
120
+ o: Address;
121
+ tickLower: bigint;
122
+ tickUpper: bigint;
123
+ }>;
124
+ result: CallContractResult<HexString>;
125
+ };
126
+ positionContractId: {
127
+ params: CallContractParams<{
128
+ pool: HexString;
129
+ o: Address;
130
+ tickLower: bigint;
131
+ tickUpper: bigint;
132
+ }>;
133
+ result: CallContractResult<HexString>;
134
+ };
135
+ getSqrtRatioAtTick: {
136
+ params: CallContractParams<{ tick: bigint }>;
137
+ result: CallContractResult<bigint>;
138
+ };
139
+ getTickAtSqrtRatio: {
140
+ params: CallContractParams<{ sqrtPriceX96: bigint }>;
141
+ result: CallContractResult<bigint>;
142
+ };
143
+ }
144
+ export type CallMethodParams<T extends keyof CallMethodTable> =
145
+ CallMethodTable[T]["params"];
146
+ export type CallMethodResult<T extends keyof CallMethodTable> =
147
+ CallMethodTable[T]["result"];
148
+ export type MultiCallParams = Partial<{
149
+ [Name in keyof CallMethodTable]: CallMethodTable[Name]["params"];
150
+ }>;
151
+ export type MultiCallResults<T extends MultiCallParams> = {
152
+ [MaybeName in keyof T]: MaybeName extends keyof CallMethodTable
153
+ ? CallMethodTable[MaybeName]["result"]
154
+ : undefined;
155
+ };
156
+ export type MulticallReturnType<Callss extends MultiCallParams[]> = {
157
+ [index in keyof Callss]: MultiCallResults<Callss[index]>;
158
+ };
159
+
160
+ export interface SignExecuteMethodTable {
161
+ addLiquidity: {
162
+ params: SignExecuteContractMethodParams<{
163
+ payer: Address;
164
+ p: types.ModifyLiquidityParams;
165
+ }>;
166
+ result: SignExecuteScriptTxResult;
167
+ };
168
+ getLiquidityForAmount0: {
169
+ params: SignExecuteContractMethodParams<{
170
+ sqrtRatioAX96: bigint;
171
+ sqrtRatioBX96: bigint;
172
+ amount0: bigint;
173
+ }>;
174
+ result: SignExecuteScriptTxResult;
175
+ };
176
+ getLiquidityForAmount1: {
177
+ params: SignExecuteContractMethodParams<{
178
+ sqrtRatioAX96: bigint;
179
+ sqrtRatioBX96: bigint;
180
+ amount1: bigint;
181
+ }>;
182
+ result: SignExecuteScriptTxResult;
183
+ };
184
+ getLiquidityForAmounts: {
185
+ params: SignExecuteContractMethodParams<{
186
+ sqrtRatioX96: bigint;
187
+ sqrtRatioAX96: bigint;
188
+ sqrtRatioBX96: bigint;
189
+ amount0: bigint;
190
+ amount1: bigint;
191
+ }>;
192
+ result: SignExecuteScriptTxResult;
193
+ };
194
+ getAmount0ForLiquidity: {
195
+ params: SignExecuteContractMethodParams<{
196
+ sqrtRatioAX96: bigint;
197
+ sqrtRatioBX96: bigint;
198
+ liquidity: bigint;
199
+ }>;
200
+ result: SignExecuteScriptTxResult;
201
+ };
202
+ mulDiv: {
203
+ params: SignExecuteContractMethodParams<{
204
+ a: bigint;
205
+ b: bigint;
206
+ denominator: bigint;
207
+ }>;
208
+ result: SignExecuteScriptTxResult;
209
+ };
210
+ mulDivRoundingUp: {
211
+ params: SignExecuteContractMethodParams<{
212
+ a: bigint;
213
+ b: bigint;
214
+ denominator: bigint;
215
+ }>;
216
+ result: SignExecuteScriptTxResult;
217
+ };
218
+ configPath: {
219
+ params: SignExecuteContractMethodParams<{ configIndex_: bigint }>;
220
+ result: SignExecuteScriptTxResult;
221
+ };
222
+ poolPath: {
223
+ params: SignExecuteContractMethodParams<{
224
+ factory: HexString;
225
+ tokens: HexString;
226
+ configIndex_: bigint;
227
+ }>;
228
+ result: SignExecuteScriptTxResult;
229
+ };
230
+ poolContractId: {
231
+ params: SignExecuteContractMethodParams<{
232
+ factory: HexString;
233
+ tokens: HexString;
234
+ configIndex_: bigint;
235
+ }>;
236
+ result: SignExecuteScriptTxResult;
237
+ };
238
+ positionPath: {
239
+ params: SignExecuteContractMethodParams<{
240
+ o: Address;
241
+ tickLower: bigint;
242
+ tickUpper: bigint;
243
+ }>;
244
+ result: SignExecuteScriptTxResult;
245
+ };
246
+ positionContractId: {
247
+ params: SignExecuteContractMethodParams<{
248
+ pool: HexString;
249
+ o: Address;
250
+ tickLower: bigint;
251
+ tickUpper: bigint;
252
+ }>;
253
+ result: SignExecuteScriptTxResult;
254
+ };
255
+ getSqrtRatioAtTick: {
256
+ params: SignExecuteContractMethodParams<{ tick: bigint }>;
257
+ result: SignExecuteScriptTxResult;
258
+ };
259
+ getTickAtSqrtRatio: {
260
+ params: SignExecuteContractMethodParams<{ sqrtPriceX96: bigint }>;
261
+ result: SignExecuteScriptTxResult;
262
+ };
263
+ }
264
+ export type SignExecuteMethodParams<T extends keyof SignExecuteMethodTable> =
265
+ SignExecuteMethodTable[T]["params"];
266
+ export type SignExecuteMethodResult<T extends keyof SignExecuteMethodTable> =
267
+ SignExecuteMethodTable[T]["result"];
268
+ }
269
+
270
+ class Factory extends ContractFactory<
271
+ LiquidityManagmentTestInstance,
272
+ LiquidityManagmentTestTypes.Fields
273
+ > {
274
+ encodeFields(fields: LiquidityManagmentTestTypes.Fields) {
275
+ return encodeContractFields(
276
+ addStdIdToFields(this.contract, fields),
277
+ this.contract.fieldsSig,
278
+ types.AllStructs
279
+ );
280
+ }
281
+
282
+ consts = {
283
+ LiquidityManagmentError: {
284
+ MintSlippage: BigInt("850"),
285
+ BurnSlippage: BigInt("851"),
286
+ },
287
+ FullMathError: { MulDivOverflow: BigInt("351") },
288
+ PathPrefixes: {
289
+ Tick: BigInt("0"),
290
+ Position: BigInt("1"),
291
+ Word: BigInt("2"),
292
+ },
293
+ TickMathError: {
294
+ SqrtPriceX96OutOfBounds: BigInt("201"),
295
+ TickOutOfBounds: BigInt("202"),
296
+ },
297
+ };
298
+
299
+ at(address: string): LiquidityManagmentTestInstance {
300
+ return new LiquidityManagmentTestInstance(address);
301
+ }
302
+
303
+ tests = {
304
+ addLiquidity: async (
305
+ params: TestContractParamsWithoutMaps<
306
+ LiquidityManagmentTestTypes.Fields,
307
+ { payer: Address; p: types.ModifyLiquidityParams }
308
+ >
309
+ ): Promise<
310
+ TestContractResultWithoutMaps<[bigint, bigint, bigint, HexString]>
311
+ > => {
312
+ return testMethod(this, "addLiquidity", params, getContractByCodeHash);
313
+ },
314
+ getLiquidityForAmount0: async (
315
+ params: TestContractParamsWithoutMaps<
316
+ LiquidityManagmentTestTypes.Fields,
317
+ { sqrtRatioAX96: bigint; sqrtRatioBX96: bigint; amount0: bigint }
318
+ >
319
+ ): Promise<TestContractResultWithoutMaps<bigint>> => {
320
+ return testMethod(
321
+ this,
322
+ "getLiquidityForAmount0",
323
+ params,
324
+ getContractByCodeHash
325
+ );
326
+ },
327
+ getLiquidityForAmount1: async (
328
+ params: TestContractParamsWithoutMaps<
329
+ LiquidityManagmentTestTypes.Fields,
330
+ { sqrtRatioAX96: bigint; sqrtRatioBX96: bigint; amount1: bigint }
331
+ >
332
+ ): Promise<TestContractResultWithoutMaps<bigint>> => {
333
+ return testMethod(
334
+ this,
335
+ "getLiquidityForAmount1",
336
+ params,
337
+ getContractByCodeHash
338
+ );
339
+ },
340
+ getLiquidityForAmounts: async (
341
+ params: TestContractParamsWithoutMaps<
342
+ LiquidityManagmentTestTypes.Fields,
343
+ {
344
+ sqrtRatioX96: bigint;
345
+ sqrtRatioAX96: bigint;
346
+ sqrtRatioBX96: bigint;
347
+ amount0: bigint;
348
+ amount1: bigint;
349
+ }
350
+ >
351
+ ): Promise<TestContractResultWithoutMaps<bigint>> => {
352
+ return testMethod(
353
+ this,
354
+ "getLiquidityForAmounts",
355
+ params,
356
+ getContractByCodeHash
357
+ );
358
+ },
359
+ getAmount0ForLiquidity: async (
360
+ params: TestContractParamsWithoutMaps<
361
+ LiquidityManagmentTestTypes.Fields,
362
+ { sqrtRatioAX96: bigint; sqrtRatioBX96: bigint; liquidity: bigint }
363
+ >
364
+ ): Promise<TestContractResultWithoutMaps<bigint>> => {
365
+ return testMethod(
366
+ this,
367
+ "getAmount0ForLiquidity",
368
+ params,
369
+ getContractByCodeHash
370
+ );
371
+ },
372
+ mulDiv: async (
373
+ params: TestContractParamsWithoutMaps<
374
+ LiquidityManagmentTestTypes.Fields,
375
+ { a: bigint; b: bigint; denominator: bigint }
376
+ >
377
+ ): Promise<TestContractResultWithoutMaps<bigint>> => {
378
+ return testMethod(this, "mulDiv", params, getContractByCodeHash);
379
+ },
380
+ mulDivRoundingUp: async (
381
+ params: TestContractParamsWithoutMaps<
382
+ LiquidityManagmentTestTypes.Fields,
383
+ { a: bigint; b: bigint; denominator: bigint }
384
+ >
385
+ ): Promise<TestContractResultWithoutMaps<bigint>> => {
386
+ return testMethod(
387
+ this,
388
+ "mulDivRoundingUp",
389
+ params,
390
+ getContractByCodeHash
391
+ );
392
+ },
393
+ configPath: async (
394
+ params: TestContractParamsWithoutMaps<
395
+ LiquidityManagmentTestTypes.Fields,
396
+ { configIndex_: bigint }
397
+ >
398
+ ): Promise<TestContractResultWithoutMaps<HexString>> => {
399
+ return testMethod(this, "configPath", params, getContractByCodeHash);
400
+ },
401
+ poolPath: async (
402
+ params: TestContractParamsWithoutMaps<
403
+ LiquidityManagmentTestTypes.Fields,
404
+ { factory: HexString; tokens: HexString; configIndex_: bigint }
405
+ >
406
+ ): Promise<TestContractResultWithoutMaps<HexString>> => {
407
+ return testMethod(this, "poolPath", params, getContractByCodeHash);
408
+ },
409
+ poolContractId: async (
410
+ params: TestContractParamsWithoutMaps<
411
+ LiquidityManagmentTestTypes.Fields,
412
+ { factory: HexString; tokens: HexString; configIndex_: bigint }
413
+ >
414
+ ): Promise<TestContractResultWithoutMaps<HexString>> => {
415
+ return testMethod(this, "poolContractId", params, getContractByCodeHash);
416
+ },
417
+ positionPath: async (
418
+ params: TestContractParamsWithoutMaps<
419
+ LiquidityManagmentTestTypes.Fields,
420
+ { o: Address; tickLower: bigint; tickUpper: bigint }
421
+ >
422
+ ): Promise<TestContractResultWithoutMaps<HexString>> => {
423
+ return testMethod(this, "positionPath", params, getContractByCodeHash);
424
+ },
425
+ positionContractId: async (
426
+ params: TestContractParamsWithoutMaps<
427
+ LiquidityManagmentTestTypes.Fields,
428
+ { pool: HexString; o: Address; tickLower: bigint; tickUpper: bigint }
429
+ >
430
+ ): Promise<TestContractResultWithoutMaps<HexString>> => {
431
+ return testMethod(
432
+ this,
433
+ "positionContractId",
434
+ params,
435
+ getContractByCodeHash
436
+ );
437
+ },
438
+ getSqrtRatioAtTick: async (
439
+ params: TestContractParamsWithoutMaps<
440
+ LiquidityManagmentTestTypes.Fields,
441
+ { tick: bigint }
442
+ >
443
+ ): Promise<TestContractResultWithoutMaps<bigint>> => {
444
+ return testMethod(
445
+ this,
446
+ "getSqrtRatioAtTick",
447
+ params,
448
+ getContractByCodeHash
449
+ );
450
+ },
451
+ getTickAtSqrtRatio: async (
452
+ params: TestContractParamsWithoutMaps<
453
+ LiquidityManagmentTestTypes.Fields,
454
+ { sqrtPriceX96: bigint }
455
+ >
456
+ ): Promise<TestContractResultWithoutMaps<bigint>> => {
457
+ return testMethod(
458
+ this,
459
+ "getTickAtSqrtRatio",
460
+ params,
461
+ getContractByCodeHash
462
+ );
463
+ },
464
+ };
465
+
466
+ stateForTest(
467
+ initFields: LiquidityManagmentTestTypes.Fields,
468
+ asset?: Asset,
469
+ address?: string
470
+ ) {
471
+ return this.stateForTest_(initFields, asset, address, undefined);
472
+ }
473
+ }
474
+
475
+ // Use this object to test and deploy the contract
476
+ export const LiquidityManagmentTest = new Factory(
477
+ Contract.fromJson(
478
+ LiquidityManagmentTestContractJson,
479
+ "",
480
+ "8824caa1efe83247812dfa7f32a80ae3d4603937df2b062437581ac421fa817d",
481
+ types.AllStructs
482
+ )
483
+ );
484
+ registerContract(LiquidityManagmentTest);
485
+
486
+ // Use this class to interact with the blockchain
487
+ export class LiquidityManagmentTestInstance extends ContractInstance {
488
+ constructor(address: Address) {
489
+ super(address);
490
+ }
491
+
492
+ async fetchState(): Promise<LiquidityManagmentTestTypes.State> {
493
+ return fetchContractState(LiquidityManagmentTest, this);
494
+ }
495
+
496
+ view = {
497
+ addLiquidity: async (
498
+ params: LiquidityManagmentTestTypes.CallMethodParams<"addLiquidity">
499
+ ): Promise<
500
+ LiquidityManagmentTestTypes.CallMethodResult<"addLiquidity">
501
+ > => {
502
+ return callMethod(
503
+ LiquidityManagmentTest,
504
+ this,
505
+ "addLiquidity",
506
+ params,
507
+ getContractByCodeHash
508
+ );
509
+ },
510
+ getLiquidityForAmount0: async (
511
+ params: LiquidityManagmentTestTypes.CallMethodParams<"getLiquidityForAmount0">
512
+ ): Promise<
513
+ LiquidityManagmentTestTypes.CallMethodResult<"getLiquidityForAmount0">
514
+ > => {
515
+ return callMethod(
516
+ LiquidityManagmentTest,
517
+ this,
518
+ "getLiquidityForAmount0",
519
+ params,
520
+ getContractByCodeHash
521
+ );
522
+ },
523
+ getLiquidityForAmount1: async (
524
+ params: LiquidityManagmentTestTypes.CallMethodParams<"getLiquidityForAmount1">
525
+ ): Promise<
526
+ LiquidityManagmentTestTypes.CallMethodResult<"getLiquidityForAmount1">
527
+ > => {
528
+ return callMethod(
529
+ LiquidityManagmentTest,
530
+ this,
531
+ "getLiquidityForAmount1",
532
+ params,
533
+ getContractByCodeHash
534
+ );
535
+ },
536
+ getLiquidityForAmounts: async (
537
+ params: LiquidityManagmentTestTypes.CallMethodParams<"getLiquidityForAmounts">
538
+ ): Promise<
539
+ LiquidityManagmentTestTypes.CallMethodResult<"getLiquidityForAmounts">
540
+ > => {
541
+ return callMethod(
542
+ LiquidityManagmentTest,
543
+ this,
544
+ "getLiquidityForAmounts",
545
+ params,
546
+ getContractByCodeHash
547
+ );
548
+ },
549
+ getAmount0ForLiquidity: async (
550
+ params: LiquidityManagmentTestTypes.CallMethodParams<"getAmount0ForLiquidity">
551
+ ): Promise<
552
+ LiquidityManagmentTestTypes.CallMethodResult<"getAmount0ForLiquidity">
553
+ > => {
554
+ return callMethod(
555
+ LiquidityManagmentTest,
556
+ this,
557
+ "getAmount0ForLiquidity",
558
+ params,
559
+ getContractByCodeHash
560
+ );
561
+ },
562
+ mulDiv: async (
563
+ params: LiquidityManagmentTestTypes.CallMethodParams<"mulDiv">
564
+ ): Promise<LiquidityManagmentTestTypes.CallMethodResult<"mulDiv">> => {
565
+ return callMethod(
566
+ LiquidityManagmentTest,
567
+ this,
568
+ "mulDiv",
569
+ params,
570
+ getContractByCodeHash
571
+ );
572
+ },
573
+ mulDivRoundingUp: async (
574
+ params: LiquidityManagmentTestTypes.CallMethodParams<"mulDivRoundingUp">
575
+ ): Promise<
576
+ LiquidityManagmentTestTypes.CallMethodResult<"mulDivRoundingUp">
577
+ > => {
578
+ return callMethod(
579
+ LiquidityManagmentTest,
580
+ this,
581
+ "mulDivRoundingUp",
582
+ params,
583
+ getContractByCodeHash
584
+ );
585
+ },
586
+ configPath: async (
587
+ params: LiquidityManagmentTestTypes.CallMethodParams<"configPath">
588
+ ): Promise<LiquidityManagmentTestTypes.CallMethodResult<"configPath">> => {
589
+ return callMethod(
590
+ LiquidityManagmentTest,
591
+ this,
592
+ "configPath",
593
+ params,
594
+ getContractByCodeHash
595
+ );
596
+ },
597
+ poolPath: async (
598
+ params: LiquidityManagmentTestTypes.CallMethodParams<"poolPath">
599
+ ): Promise<LiquidityManagmentTestTypes.CallMethodResult<"poolPath">> => {
600
+ return callMethod(
601
+ LiquidityManagmentTest,
602
+ this,
603
+ "poolPath",
604
+ params,
605
+ getContractByCodeHash
606
+ );
607
+ },
608
+ poolContractId: async (
609
+ params: LiquidityManagmentTestTypes.CallMethodParams<"poolContractId">
610
+ ): Promise<
611
+ LiquidityManagmentTestTypes.CallMethodResult<"poolContractId">
612
+ > => {
613
+ return callMethod(
614
+ LiquidityManagmentTest,
615
+ this,
616
+ "poolContractId",
617
+ params,
618
+ getContractByCodeHash
619
+ );
620
+ },
621
+ positionPath: async (
622
+ params: LiquidityManagmentTestTypes.CallMethodParams<"positionPath">
623
+ ): Promise<
624
+ LiquidityManagmentTestTypes.CallMethodResult<"positionPath">
625
+ > => {
626
+ return callMethod(
627
+ LiquidityManagmentTest,
628
+ this,
629
+ "positionPath",
630
+ params,
631
+ getContractByCodeHash
632
+ );
633
+ },
634
+ positionContractId: async (
635
+ params: LiquidityManagmentTestTypes.CallMethodParams<"positionContractId">
636
+ ): Promise<
637
+ LiquidityManagmentTestTypes.CallMethodResult<"positionContractId">
638
+ > => {
639
+ return callMethod(
640
+ LiquidityManagmentTest,
641
+ this,
642
+ "positionContractId",
643
+ params,
644
+ getContractByCodeHash
645
+ );
646
+ },
647
+ getSqrtRatioAtTick: async (
648
+ params: LiquidityManagmentTestTypes.CallMethodParams<"getSqrtRatioAtTick">
649
+ ): Promise<
650
+ LiquidityManagmentTestTypes.CallMethodResult<"getSqrtRatioAtTick">
651
+ > => {
652
+ return callMethod(
653
+ LiquidityManagmentTest,
654
+ this,
655
+ "getSqrtRatioAtTick",
656
+ params,
657
+ getContractByCodeHash
658
+ );
659
+ },
660
+ getTickAtSqrtRatio: async (
661
+ params: LiquidityManagmentTestTypes.CallMethodParams<"getTickAtSqrtRatio">
662
+ ): Promise<
663
+ LiquidityManagmentTestTypes.CallMethodResult<"getTickAtSqrtRatio">
664
+ > => {
665
+ return callMethod(
666
+ LiquidityManagmentTest,
667
+ this,
668
+ "getTickAtSqrtRatio",
669
+ params,
670
+ getContractByCodeHash
671
+ );
672
+ },
673
+ };
674
+
675
+ transact = {
676
+ addLiquidity: async (
677
+ params: LiquidityManagmentTestTypes.SignExecuteMethodParams<"addLiquidity">
678
+ ): Promise<
679
+ LiquidityManagmentTestTypes.SignExecuteMethodResult<"addLiquidity">
680
+ > => {
681
+ return signExecuteMethod(
682
+ LiquidityManagmentTest,
683
+ this,
684
+ "addLiquidity",
685
+ params
686
+ );
687
+ },
688
+ getLiquidityForAmount0: async (
689
+ params: LiquidityManagmentTestTypes.SignExecuteMethodParams<"getLiquidityForAmount0">
690
+ ): Promise<
691
+ LiquidityManagmentTestTypes.SignExecuteMethodResult<"getLiquidityForAmount0">
692
+ > => {
693
+ return signExecuteMethod(
694
+ LiquidityManagmentTest,
695
+ this,
696
+ "getLiquidityForAmount0",
697
+ params
698
+ );
699
+ },
700
+ getLiquidityForAmount1: async (
701
+ params: LiquidityManagmentTestTypes.SignExecuteMethodParams<"getLiquidityForAmount1">
702
+ ): Promise<
703
+ LiquidityManagmentTestTypes.SignExecuteMethodResult<"getLiquidityForAmount1">
704
+ > => {
705
+ return signExecuteMethod(
706
+ LiquidityManagmentTest,
707
+ this,
708
+ "getLiquidityForAmount1",
709
+ params
710
+ );
711
+ },
712
+ getLiquidityForAmounts: async (
713
+ params: LiquidityManagmentTestTypes.SignExecuteMethodParams<"getLiquidityForAmounts">
714
+ ): Promise<
715
+ LiquidityManagmentTestTypes.SignExecuteMethodResult<"getLiquidityForAmounts">
716
+ > => {
717
+ return signExecuteMethod(
718
+ LiquidityManagmentTest,
719
+ this,
720
+ "getLiquidityForAmounts",
721
+ params
722
+ );
723
+ },
724
+ getAmount0ForLiquidity: async (
725
+ params: LiquidityManagmentTestTypes.SignExecuteMethodParams<"getAmount0ForLiquidity">
726
+ ): Promise<
727
+ LiquidityManagmentTestTypes.SignExecuteMethodResult<"getAmount0ForLiquidity">
728
+ > => {
729
+ return signExecuteMethod(
730
+ LiquidityManagmentTest,
731
+ this,
732
+ "getAmount0ForLiquidity",
733
+ params
734
+ );
735
+ },
736
+ mulDiv: async (
737
+ params: LiquidityManagmentTestTypes.SignExecuteMethodParams<"mulDiv">
738
+ ): Promise<
739
+ LiquidityManagmentTestTypes.SignExecuteMethodResult<"mulDiv">
740
+ > => {
741
+ return signExecuteMethod(LiquidityManagmentTest, this, "mulDiv", params);
742
+ },
743
+ mulDivRoundingUp: async (
744
+ params: LiquidityManagmentTestTypes.SignExecuteMethodParams<"mulDivRoundingUp">
745
+ ): Promise<
746
+ LiquidityManagmentTestTypes.SignExecuteMethodResult<"mulDivRoundingUp">
747
+ > => {
748
+ return signExecuteMethod(
749
+ LiquidityManagmentTest,
750
+ this,
751
+ "mulDivRoundingUp",
752
+ params
753
+ );
754
+ },
755
+ configPath: async (
756
+ params: LiquidityManagmentTestTypes.SignExecuteMethodParams<"configPath">
757
+ ): Promise<
758
+ LiquidityManagmentTestTypes.SignExecuteMethodResult<"configPath">
759
+ > => {
760
+ return signExecuteMethod(
761
+ LiquidityManagmentTest,
762
+ this,
763
+ "configPath",
764
+ params
765
+ );
766
+ },
767
+ poolPath: async (
768
+ params: LiquidityManagmentTestTypes.SignExecuteMethodParams<"poolPath">
769
+ ): Promise<
770
+ LiquidityManagmentTestTypes.SignExecuteMethodResult<"poolPath">
771
+ > => {
772
+ return signExecuteMethod(
773
+ LiquidityManagmentTest,
774
+ this,
775
+ "poolPath",
776
+ params
777
+ );
778
+ },
779
+ poolContractId: async (
780
+ params: LiquidityManagmentTestTypes.SignExecuteMethodParams<"poolContractId">
781
+ ): Promise<
782
+ LiquidityManagmentTestTypes.SignExecuteMethodResult<"poolContractId">
783
+ > => {
784
+ return signExecuteMethod(
785
+ LiquidityManagmentTest,
786
+ this,
787
+ "poolContractId",
788
+ params
789
+ );
790
+ },
791
+ positionPath: async (
792
+ params: LiquidityManagmentTestTypes.SignExecuteMethodParams<"positionPath">
793
+ ): Promise<
794
+ LiquidityManagmentTestTypes.SignExecuteMethodResult<"positionPath">
795
+ > => {
796
+ return signExecuteMethod(
797
+ LiquidityManagmentTest,
798
+ this,
799
+ "positionPath",
800
+ params
801
+ );
802
+ },
803
+ positionContractId: async (
804
+ params: LiquidityManagmentTestTypes.SignExecuteMethodParams<"positionContractId">
805
+ ): Promise<
806
+ LiquidityManagmentTestTypes.SignExecuteMethodResult<"positionContractId">
807
+ > => {
808
+ return signExecuteMethod(
809
+ LiquidityManagmentTest,
810
+ this,
811
+ "positionContractId",
812
+ params
813
+ );
814
+ },
815
+ getSqrtRatioAtTick: async (
816
+ params: LiquidityManagmentTestTypes.SignExecuteMethodParams<"getSqrtRatioAtTick">
817
+ ): Promise<
818
+ LiquidityManagmentTestTypes.SignExecuteMethodResult<"getSqrtRatioAtTick">
819
+ > => {
820
+ return signExecuteMethod(
821
+ LiquidityManagmentTest,
822
+ this,
823
+ "getSqrtRatioAtTick",
824
+ params
825
+ );
826
+ },
827
+ getTickAtSqrtRatio: async (
828
+ params: LiquidityManagmentTestTypes.SignExecuteMethodParams<"getTickAtSqrtRatio">
829
+ ): Promise<
830
+ LiquidityManagmentTestTypes.SignExecuteMethodResult<"getTickAtSqrtRatio">
831
+ > => {
832
+ return signExecuteMethod(
833
+ LiquidityManagmentTest,
834
+ this,
835
+ "getTickAtSqrtRatio",
836
+ params
837
+ );
838
+ },
839
+ };
840
+
841
+ async multicall<Calls extends LiquidityManagmentTestTypes.MultiCallParams>(
842
+ calls: Calls
843
+ ): Promise<LiquidityManagmentTestTypes.MultiCallResults<Calls>>;
844
+ async multicall<Callss extends LiquidityManagmentTestTypes.MultiCallParams[]>(
845
+ callss: Narrow<Callss>
846
+ ): Promise<LiquidityManagmentTestTypes.MulticallReturnType<Callss>>;
847
+ async multicall<
848
+ Callss extends
849
+ | LiquidityManagmentTestTypes.MultiCallParams
850
+ | LiquidityManagmentTestTypes.MultiCallParams[]
851
+ >(callss: Callss): Promise<unknown> {
852
+ return await multicallMethods(
853
+ LiquidityManagmentTest,
854
+ this,
855
+ callss,
856
+ getContractByCodeHash
857
+ );
858
+ }
859
+ }