@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.
- package/README.md +4 -0
- package/clmm/artifacts/BitmapWord.ral.json +125 -0
- package/clmm/artifacts/BitmapWordDeployer.ral.json +31 -0
- package/clmm/artifacts/CreateConfig.ral.json +37 -0
- package/clmm/artifacts/CreateLiquidPool.ral.json +55 -0
- package/clmm/artifacts/DexAccount.ral.json +110 -0
- package/clmm/artifacts/LiquidityAmountsTest.ral.json +161 -0
- package/clmm/artifacts/LiquidityManagmentTest.ral.json +384 -0
- package/clmm/artifacts/Pool.ral.json +1530 -0
- package/clmm/artifacts/PoolConfig.ral.json +31 -0
- package/clmm/artifacts/PoolFactory.ral.json +300 -0
- package/clmm/artifacts/PoolRouterDemo.ral.json +49 -0
- package/clmm/artifacts/PoolUser.ral.json +89 -0
- package/clmm/artifacts/Position.ral.json +183 -0
- package/clmm/artifacts/PositionManager.ral.json +416 -0
- package/clmm/artifacts/SwapWithoutAccount.ral.json +46 -0
- package/clmm/artifacts/TestToken.ral.json +68 -0
- package/clmm/artifacts/Tick.ral.json +161 -0
- package/clmm/artifacts/TickBitmapTest.ral.json +220 -0
- package/clmm/artifacts/constants.ral.json +81 -0
- package/clmm/artifacts/structs.ral.json +335 -0
- package/clmm/artifacts/ts/BitmapWord.ts +337 -0
- package/clmm/artifacts/ts/BitmapWordDeployer.ts +164 -0
- package/clmm/artifacts/ts/DexAccount.ts +330 -0
- package/clmm/artifacts/ts/LiquidityAmountsTest.ts +464 -0
- package/clmm/artifacts/ts/LiquidityManagmentTest.ts +859 -0
- package/clmm/artifacts/ts/Pool.ts +2535 -0
- package/clmm/artifacts/ts/PoolConfig.ts +179 -0
- package/clmm/artifacts/ts/PoolFactory.ts +640 -0
- package/clmm/artifacts/ts/PoolUser.ts +237 -0
- package/clmm/artifacts/ts/Position.ts +440 -0
- package/clmm/artifacts/ts/PositionManager.ts +929 -0
- package/clmm/artifacts/ts/TestToken.ts +277 -0
- package/clmm/artifacts/ts/Tick.ts +351 -0
- package/clmm/artifacts/ts/TickBitmapTest.ts +512 -0
- package/clmm/artifacts/ts/constants.ts +17 -0
- package/clmm/artifacts/ts/contracts.ts +26 -0
- package/clmm/artifacts/ts/deployments.ts +160 -0
- package/clmm/artifacts/ts/index.ts +20 -0
- package/clmm/artifacts/ts/scripts.ts +76 -0
- package/clmm/artifacts/ts/types.ts +105 -0
- package/clmm/deployments/.deployments.devnet.json +350 -0
- package/clmm/deployments/.deployments.testnet.json +350 -0
- package/cpmm/artifacts/dex/DexAccount.ral.json +110 -0
- package/cpmm/artifacts/dex/Router.ral.json +361 -0
- package/cpmm/artifacts/dex/TokenPair.ral.json +512 -0
- package/cpmm/artifacts/dex/TokenPairFactory.ral.json +297 -0
- package/cpmm/artifacts/examples/ExampleOracleSimple.ral.json +192 -0
- package/cpmm/artifacts/examples/FeeCollectorFactoryImpl.ral.json +185 -0
- package/cpmm/artifacts/examples/FeeCollectorPerTokenPairImpl.ral.json +216 -0
- package/cpmm/artifacts/examples/FullMathTest.ral.json +123 -0
- package/cpmm/artifacts/scripts/AddLiquidity.ral.json +46 -0
- package/cpmm/artifacts/scripts/Burn.ral.json +31 -0
- package/cpmm/artifacts/scripts/CollectFee.ral.json +25 -0
- package/cpmm/artifacts/scripts/CreatePair.ral.json +37 -0
- package/cpmm/artifacts/scripts/CreatePairAndAddLiquidity.ral.json +43 -0
- package/cpmm/artifacts/scripts/EnableFeeCollector.ral.json +28 -0
- package/cpmm/artifacts/scripts/Mint.ral.json +34 -0
- package/cpmm/artifacts/scripts/RemoveLiquidity.ral.json +43 -0
- package/cpmm/artifacts/scripts/SetFeeCollectorFactory.ral.json +28 -0
- package/cpmm/artifacts/scripts/Swap.ral.json +46 -0
- package/cpmm/artifacts/scripts/SwapMaxIn.ral.json +46 -0
- package/cpmm/artifacts/scripts/SwapMinOut.ral.json +46 -0
- package/cpmm/artifacts/test/GetToken.ral.json +31 -0
- package/cpmm/artifacts/test/MathTest.ral.json +49 -0
- package/cpmm/artifacts/test/TestToken.ral.json +87 -0
- package/cpmm/artifacts/ts/DexAccount.ts +329 -0
- package/cpmm/artifacts/ts/ExampleOracleSimple.ts +383 -0
- package/cpmm/artifacts/ts/FeeCollectorFactoryImpl.ts +227 -0
- package/cpmm/artifacts/ts/FeeCollectorPerTokenPairImpl.ts +327 -0
- package/cpmm/artifacts/ts/FullMathTest.ts +251 -0
- package/cpmm/artifacts/ts/MathTest.ts +183 -0
- package/cpmm/artifacts/ts/Router.ts +554 -0
- package/cpmm/artifacts/ts/TestToken.ts +312 -0
- package/cpmm/artifacts/ts/TokenPair.ts +947 -0
- package/cpmm/artifacts/ts/TokenPairFactory.ts +501 -0
- package/cpmm/artifacts/ts/contracts.ts +26 -0
- package/cpmm/artifacts/ts/deployments.ts +109 -0
- package/cpmm/artifacts/ts/index.ts +16 -0
- package/cpmm/artifacts/ts/scripts.ts +142 -0
- package/cpmm/deployments/.deployments.devnet.json +77 -0
- package/cpmm/deployments/.deployments.testnet.json +79 -0
- package/lib/index.d.mts +8800 -0
- package/lib/index.d.ts +8800 -0
- package/lib/index.js +21769 -0
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +22118 -0
- package/lib/index.mjs.map +1 -0
- package/package.json +80 -0
- package/src/clmm/clmm.ts +607 -0
- package/src/clmm/constants.ts +7 -0
- package/src/clmm/index.ts +6 -0
- package/src/clmm/liquidity.ts +163 -0
- package/src/clmm/pool.ts +154 -0
- package/src/clmm/tick.ts +335 -0
- package/src/clmm/types.ts +155 -0
- package/src/common/constants.ts +1 -0
- package/src/common/error.ts +46 -0
- package/src/common/index.ts +7 -0
- package/src/common/logger.ts +82 -0
- package/src/common/math.ts +88 -0
- package/src/common/numeric.ts +64 -0
- package/src/common/types.ts +49 -0
- package/src/common/utils.ts +3 -0
- package/src/cpmm/constants.ts +2 -0
- package/src/cpmm/cpmm.ts +631 -0
- package/src/cpmm/index.ts +3 -0
- package/src/cpmm/types.ts +113 -0
- package/src/index.ts +25 -0
- package/src/moduleBase.ts +64 -0
- package/src/staking/index.ts +4 -0
- package/src/staking/settings.ts +38 -0
- package/src/staking/staking.ts +277 -0
- package/src/staking/types.ts +15 -0
- package/src/staking/utils.ts +25 -0
- package/src/token/index.ts +1 -0
- package/src/token/token.ts +163 -0
- package/src/zeta.ts +105 -0
- package/staking/artifacts/AlphStakeAndLock.ral.json +31 -0
- package/staking/artifacts/AlphUnstakeVault.ral.json +151 -0
- package/staking/artifacts/XAlphStakeVault.ral.json +559 -0
- package/staking/artifacts/XAlphToken.ral.json +404 -0
- package/staking/artifacts/XAlphUnlockAndStartUnstake.ral.json +31 -0
- package/staking/artifacts/examples/GovernanceDemo.ral.json +282 -0
- package/staking/artifacts/examples/RewardSharingVault.ral.json +253 -0
- package/staking/artifacts/structs.ral.json +47 -0
- package/staking/artifacts/ts/AlphUnstakeVault.ts +354 -0
- package/staking/artifacts/ts/FullMathTest.ts +175 -0
- package/staking/artifacts/ts/GovernanceDemo.ts +726 -0
- package/staking/artifacts/ts/RewardSharingVault.ts +559 -0
- package/staking/artifacts/ts/TestDynamicArrayByteVec32.ts +431 -0
- package/staking/artifacts/ts/TestDynamicSortedArrayForU256.ts +516 -0
- package/staking/artifacts/ts/TestMerkleProof.ts +343 -0
- package/staking/artifacts/ts/XAlphStakeVault.ts +1120 -0
- package/staking/artifacts/ts/XAlphToken.ts +835 -0
- package/staking/artifacts/ts/contracts.ts +26 -0
- package/staking/artifacts/ts/deployments.ts +109 -0
- package/staking/artifacts/ts/index.ts +15 -0
- package/staking/artifacts/ts/scripts.ts +35 -0
- package/staking/artifacts/ts/types.ts +19 -0
- package/staking/artifacts/utils/FullMathTest.ral.json +57 -0
- package/staking/artifacts/utils/TestDynamicArrayByteVec32.ral.json +165 -0
- package/staking/artifacts/utils/TestDynamicSortedArrayForU256.ral.json +189 -0
- package/staking/artifacts/utils/TestMerkleProof.ral.json +134 -0
- package/staking/deployments/.deployments.devnet.json +77 -0
- package/staking/deployments/.deployments.testnet.json +78 -0
|
@@ -0,0 +1,947 @@
|
|
|
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 TokenPairContractJson } from "../dex/TokenPair.ral.json";
|
|
37
|
+
import { getContractByCodeHash, registerContract } from "./contracts";
|
|
38
|
+
|
|
39
|
+
// Custom types for the contract
|
|
40
|
+
export namespace TokenPairTypes {
|
|
41
|
+
export type Fields = {
|
|
42
|
+
tokenPairFactory: HexString;
|
|
43
|
+
token0Id: HexString;
|
|
44
|
+
token1Id: HexString;
|
|
45
|
+
dexAccount0: HexString;
|
|
46
|
+
reserve0: bigint;
|
|
47
|
+
reserve1: bigint;
|
|
48
|
+
blockTimeStampLast: bigint;
|
|
49
|
+
price0CumulativeLast: bigint;
|
|
50
|
+
price1CumulativeLast: bigint;
|
|
51
|
+
totalSupply: bigint;
|
|
52
|
+
kLast: bigint;
|
|
53
|
+
feeCollectorId: HexString;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type State = ContractState<Fields>;
|
|
57
|
+
|
|
58
|
+
export type MintEvent = ContractEvent<{
|
|
59
|
+
sender: Address;
|
|
60
|
+
amount0: bigint;
|
|
61
|
+
amount1: bigint;
|
|
62
|
+
liquidity: bigint;
|
|
63
|
+
totalSupply: bigint;
|
|
64
|
+
}>;
|
|
65
|
+
export type BurnEvent = ContractEvent<{
|
|
66
|
+
sender: Address;
|
|
67
|
+
amount0: bigint;
|
|
68
|
+
amount1: bigint;
|
|
69
|
+
liquidity: bigint;
|
|
70
|
+
totalSupply: bigint;
|
|
71
|
+
}>;
|
|
72
|
+
export type SwapEvent = ContractEvent<{
|
|
73
|
+
sender: Address;
|
|
74
|
+
amount0In: bigint;
|
|
75
|
+
amount1In: bigint;
|
|
76
|
+
amount0Out: bigint;
|
|
77
|
+
amount1Out: bigint;
|
|
78
|
+
to: Address;
|
|
79
|
+
}>;
|
|
80
|
+
|
|
81
|
+
export interface CallMethodTable {
|
|
82
|
+
getSymbol: {
|
|
83
|
+
params: Omit<CallContractParams<{}>, "args">;
|
|
84
|
+
result: CallContractResult<HexString>;
|
|
85
|
+
};
|
|
86
|
+
getName: {
|
|
87
|
+
params: Omit<CallContractParams<{}>, "args">;
|
|
88
|
+
result: CallContractResult<HexString>;
|
|
89
|
+
};
|
|
90
|
+
getDecimals: {
|
|
91
|
+
params: Omit<CallContractParams<{}>, "args">;
|
|
92
|
+
result: CallContractResult<bigint>;
|
|
93
|
+
};
|
|
94
|
+
getTotalSupply: {
|
|
95
|
+
params: Omit<CallContractParams<{}>, "args">;
|
|
96
|
+
result: CallContractResult<bigint>;
|
|
97
|
+
};
|
|
98
|
+
uqdiv: {
|
|
99
|
+
params: CallContractParams<{ a: bigint; b: bigint }>;
|
|
100
|
+
result: CallContractResult<bigint>;
|
|
101
|
+
};
|
|
102
|
+
sqrt: {
|
|
103
|
+
params: CallContractParams<{ y: bigint }>;
|
|
104
|
+
result: CallContractResult<bigint>;
|
|
105
|
+
};
|
|
106
|
+
setFeeCollectorId: {
|
|
107
|
+
params: CallContractParams<{ id: HexString }>;
|
|
108
|
+
result: CallContractResult<null>;
|
|
109
|
+
};
|
|
110
|
+
getTokenPair: {
|
|
111
|
+
params: Omit<CallContractParams<{}>, "args">;
|
|
112
|
+
result: CallContractResult<[HexString, HexString]>;
|
|
113
|
+
};
|
|
114
|
+
getReserves: {
|
|
115
|
+
params: Omit<CallContractParams<{}>, "args">;
|
|
116
|
+
result: CallContractResult<[bigint, bigint]>;
|
|
117
|
+
};
|
|
118
|
+
getBlockTimeStampLast: {
|
|
119
|
+
params: Omit<CallContractParams<{}>, "args">;
|
|
120
|
+
result: CallContractResult<bigint>;
|
|
121
|
+
};
|
|
122
|
+
getPrice0CumulativeLast: {
|
|
123
|
+
params: Omit<CallContractParams<{}>, "args">;
|
|
124
|
+
result: CallContractResult<bigint>;
|
|
125
|
+
};
|
|
126
|
+
getPrice1CumulativeLast: {
|
|
127
|
+
params: Omit<CallContractParams<{}>, "args">;
|
|
128
|
+
result: CallContractResult<bigint>;
|
|
129
|
+
};
|
|
130
|
+
update: {
|
|
131
|
+
params: CallContractParams<{ newReserve0: bigint; newReserve1: bigint }>;
|
|
132
|
+
result: CallContractResult<null>;
|
|
133
|
+
};
|
|
134
|
+
mintFee: {
|
|
135
|
+
params: CallContractParams<{ reserve0_: bigint; reserve1_: bigint }>;
|
|
136
|
+
result: CallContractResult<[boolean, bigint]>;
|
|
137
|
+
};
|
|
138
|
+
mint: {
|
|
139
|
+
params: CallContractParams<{
|
|
140
|
+
sender: Address;
|
|
141
|
+
amount0: bigint;
|
|
142
|
+
amount1: bigint;
|
|
143
|
+
}>;
|
|
144
|
+
result: CallContractResult<bigint>;
|
|
145
|
+
};
|
|
146
|
+
burn: {
|
|
147
|
+
params: CallContractParams<{ sender: Address; liquidity: bigint }>;
|
|
148
|
+
result: CallContractResult<[bigint, bigint]>;
|
|
149
|
+
};
|
|
150
|
+
swap: {
|
|
151
|
+
params: CallContractParams<{
|
|
152
|
+
sender: Address;
|
|
153
|
+
to: Address;
|
|
154
|
+
amount0In: bigint;
|
|
155
|
+
amount1In: bigint;
|
|
156
|
+
amount0Out: bigint;
|
|
157
|
+
amount1Out: bigint;
|
|
158
|
+
}>;
|
|
159
|
+
result: CallContractResult<null>;
|
|
160
|
+
};
|
|
161
|
+
collectFeeManually: {
|
|
162
|
+
params: Omit<CallContractParams<{}>, "args">;
|
|
163
|
+
result: CallContractResult<null>;
|
|
164
|
+
};
|
|
165
|
+
collectFeeAndUpdateKLast: {
|
|
166
|
+
params: CallContractParams<{ feeAmount: bigint }>;
|
|
167
|
+
result: CallContractResult<null>;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
export type CallMethodParams<T extends keyof CallMethodTable> =
|
|
171
|
+
CallMethodTable[T]["params"];
|
|
172
|
+
export type CallMethodResult<T extends keyof CallMethodTable> =
|
|
173
|
+
CallMethodTable[T]["result"];
|
|
174
|
+
export type MultiCallParams = Partial<{
|
|
175
|
+
[Name in keyof CallMethodTable]: CallMethodTable[Name]["params"];
|
|
176
|
+
}>;
|
|
177
|
+
export type MultiCallResults<T extends MultiCallParams> = {
|
|
178
|
+
[MaybeName in keyof T]: MaybeName extends keyof CallMethodTable
|
|
179
|
+
? CallMethodTable[MaybeName]["result"]
|
|
180
|
+
: undefined;
|
|
181
|
+
};
|
|
182
|
+
export type MulticallReturnType<Callss extends MultiCallParams[]> = {
|
|
183
|
+
[index in keyof Callss]: MultiCallResults<Callss[index]>;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export interface SignExecuteMethodTable {
|
|
187
|
+
getSymbol: {
|
|
188
|
+
params: Omit<SignExecuteContractMethodParams<{}>, "args">;
|
|
189
|
+
result: SignExecuteScriptTxResult;
|
|
190
|
+
};
|
|
191
|
+
getName: {
|
|
192
|
+
params: Omit<SignExecuteContractMethodParams<{}>, "args">;
|
|
193
|
+
result: SignExecuteScriptTxResult;
|
|
194
|
+
};
|
|
195
|
+
getDecimals: {
|
|
196
|
+
params: Omit<SignExecuteContractMethodParams<{}>, "args">;
|
|
197
|
+
result: SignExecuteScriptTxResult;
|
|
198
|
+
};
|
|
199
|
+
getTotalSupply: {
|
|
200
|
+
params: Omit<SignExecuteContractMethodParams<{}>, "args">;
|
|
201
|
+
result: SignExecuteScriptTxResult;
|
|
202
|
+
};
|
|
203
|
+
uqdiv: {
|
|
204
|
+
params: SignExecuteContractMethodParams<{ a: bigint; b: bigint }>;
|
|
205
|
+
result: SignExecuteScriptTxResult;
|
|
206
|
+
};
|
|
207
|
+
sqrt: {
|
|
208
|
+
params: SignExecuteContractMethodParams<{ y: bigint }>;
|
|
209
|
+
result: SignExecuteScriptTxResult;
|
|
210
|
+
};
|
|
211
|
+
setFeeCollectorId: {
|
|
212
|
+
params: SignExecuteContractMethodParams<{ id: HexString }>;
|
|
213
|
+
result: SignExecuteScriptTxResult;
|
|
214
|
+
};
|
|
215
|
+
getTokenPair: {
|
|
216
|
+
params: Omit<SignExecuteContractMethodParams<{}>, "args">;
|
|
217
|
+
result: SignExecuteScriptTxResult;
|
|
218
|
+
};
|
|
219
|
+
getReserves: {
|
|
220
|
+
params: Omit<SignExecuteContractMethodParams<{}>, "args">;
|
|
221
|
+
result: SignExecuteScriptTxResult;
|
|
222
|
+
};
|
|
223
|
+
getBlockTimeStampLast: {
|
|
224
|
+
params: Omit<SignExecuteContractMethodParams<{}>, "args">;
|
|
225
|
+
result: SignExecuteScriptTxResult;
|
|
226
|
+
};
|
|
227
|
+
getPrice0CumulativeLast: {
|
|
228
|
+
params: Omit<SignExecuteContractMethodParams<{}>, "args">;
|
|
229
|
+
result: SignExecuteScriptTxResult;
|
|
230
|
+
};
|
|
231
|
+
getPrice1CumulativeLast: {
|
|
232
|
+
params: Omit<SignExecuteContractMethodParams<{}>, "args">;
|
|
233
|
+
result: SignExecuteScriptTxResult;
|
|
234
|
+
};
|
|
235
|
+
update: {
|
|
236
|
+
params: SignExecuteContractMethodParams<{
|
|
237
|
+
newReserve0: bigint;
|
|
238
|
+
newReserve1: bigint;
|
|
239
|
+
}>;
|
|
240
|
+
result: SignExecuteScriptTxResult;
|
|
241
|
+
};
|
|
242
|
+
mintFee: {
|
|
243
|
+
params: SignExecuteContractMethodParams<{
|
|
244
|
+
reserve0_: bigint;
|
|
245
|
+
reserve1_: bigint;
|
|
246
|
+
}>;
|
|
247
|
+
result: SignExecuteScriptTxResult;
|
|
248
|
+
};
|
|
249
|
+
mint: {
|
|
250
|
+
params: SignExecuteContractMethodParams<{
|
|
251
|
+
sender: Address;
|
|
252
|
+
amount0: bigint;
|
|
253
|
+
amount1: bigint;
|
|
254
|
+
}>;
|
|
255
|
+
result: SignExecuteScriptTxResult;
|
|
256
|
+
};
|
|
257
|
+
burn: {
|
|
258
|
+
params: SignExecuteContractMethodParams<{
|
|
259
|
+
sender: Address;
|
|
260
|
+
liquidity: bigint;
|
|
261
|
+
}>;
|
|
262
|
+
result: SignExecuteScriptTxResult;
|
|
263
|
+
};
|
|
264
|
+
swap: {
|
|
265
|
+
params: SignExecuteContractMethodParams<{
|
|
266
|
+
sender: Address;
|
|
267
|
+
to: Address;
|
|
268
|
+
amount0In: bigint;
|
|
269
|
+
amount1In: bigint;
|
|
270
|
+
amount0Out: bigint;
|
|
271
|
+
amount1Out: bigint;
|
|
272
|
+
}>;
|
|
273
|
+
result: SignExecuteScriptTxResult;
|
|
274
|
+
};
|
|
275
|
+
collectFeeManually: {
|
|
276
|
+
params: Omit<SignExecuteContractMethodParams<{}>, "args">;
|
|
277
|
+
result: SignExecuteScriptTxResult;
|
|
278
|
+
};
|
|
279
|
+
collectFeeAndUpdateKLast: {
|
|
280
|
+
params: SignExecuteContractMethodParams<{ feeAmount: bigint }>;
|
|
281
|
+
result: SignExecuteScriptTxResult;
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
export type SignExecuteMethodParams<T extends keyof SignExecuteMethodTable> =
|
|
285
|
+
SignExecuteMethodTable[T]["params"];
|
|
286
|
+
export type SignExecuteMethodResult<T extends keyof SignExecuteMethodTable> =
|
|
287
|
+
SignExecuteMethodTable[T]["result"];
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
class Factory extends ContractFactory<
|
|
291
|
+
TokenPairInstance,
|
|
292
|
+
TokenPairTypes.Fields
|
|
293
|
+
> {
|
|
294
|
+
encodeFields(fields: TokenPairTypes.Fields) {
|
|
295
|
+
return encodeContractFields(
|
|
296
|
+
addStdIdToFields(this.contract, fields),
|
|
297
|
+
this.contract.fieldsSig,
|
|
298
|
+
[]
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
eventIndex = { Mint: 0, Burn: 1, Swap: 2 };
|
|
303
|
+
consts = {
|
|
304
|
+
MINIMUM_LIQUIDITY: BigInt("1000"),
|
|
305
|
+
ErrorCodes: {
|
|
306
|
+
ReserveOverflow: BigInt("0"),
|
|
307
|
+
InsufficientInitLiquidity: BigInt("1"),
|
|
308
|
+
InsufficientLiquidityMinted: BigInt("2"),
|
|
309
|
+
InsufficientLiquidityBurned: BigInt("3"),
|
|
310
|
+
InvalidToAddress: BigInt("4"),
|
|
311
|
+
InsufficientLiquidity: BigInt("5"),
|
|
312
|
+
InvalidTokenInId: BigInt("6"),
|
|
313
|
+
InvalidCalleeId: BigInt("7"),
|
|
314
|
+
InvalidK: BigInt("8"),
|
|
315
|
+
InsufficientOutputAmount: BigInt("9"),
|
|
316
|
+
InsufficientInputAmount: BigInt("10"),
|
|
317
|
+
IdenticalTokenIds: BigInt("11"),
|
|
318
|
+
Expired: BigInt("12"),
|
|
319
|
+
InsufficientToken0Amount: BigInt("13"),
|
|
320
|
+
InsufficientToken1Amount: BigInt("14"),
|
|
321
|
+
TokenNotExist: BigInt("15"),
|
|
322
|
+
InvalidCaller: BigInt("16"),
|
|
323
|
+
FeeCollectorNotEnabled: BigInt("17"),
|
|
324
|
+
InvalidAccount: BigInt("18"),
|
|
325
|
+
},
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
at(address: string): TokenPairInstance {
|
|
329
|
+
return new TokenPairInstance(address);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
tests = {
|
|
333
|
+
getSymbol: async (
|
|
334
|
+
params: Omit<
|
|
335
|
+
TestContractParamsWithoutMaps<TokenPairTypes.Fields, never>,
|
|
336
|
+
"args"
|
|
337
|
+
>
|
|
338
|
+
): Promise<TestContractResultWithoutMaps<HexString>> => {
|
|
339
|
+
return testMethod(this, "getSymbol", params, getContractByCodeHash);
|
|
340
|
+
},
|
|
341
|
+
getName: async (
|
|
342
|
+
params: Omit<
|
|
343
|
+
TestContractParamsWithoutMaps<TokenPairTypes.Fields, never>,
|
|
344
|
+
"args"
|
|
345
|
+
>
|
|
346
|
+
): Promise<TestContractResultWithoutMaps<HexString>> => {
|
|
347
|
+
return testMethod(this, "getName", params, getContractByCodeHash);
|
|
348
|
+
},
|
|
349
|
+
getDecimals: async (
|
|
350
|
+
params: Omit<
|
|
351
|
+
TestContractParamsWithoutMaps<TokenPairTypes.Fields, never>,
|
|
352
|
+
"args"
|
|
353
|
+
>
|
|
354
|
+
): Promise<TestContractResultWithoutMaps<bigint>> => {
|
|
355
|
+
return testMethod(this, "getDecimals", params, getContractByCodeHash);
|
|
356
|
+
},
|
|
357
|
+
getTotalSupply: async (
|
|
358
|
+
params: Omit<
|
|
359
|
+
TestContractParamsWithoutMaps<TokenPairTypes.Fields, never>,
|
|
360
|
+
"args"
|
|
361
|
+
>
|
|
362
|
+
): Promise<TestContractResultWithoutMaps<bigint>> => {
|
|
363
|
+
return testMethod(this, "getTotalSupply", params, getContractByCodeHash);
|
|
364
|
+
},
|
|
365
|
+
uqdiv: async (
|
|
366
|
+
params: TestContractParamsWithoutMaps<
|
|
367
|
+
TokenPairTypes.Fields,
|
|
368
|
+
{ a: bigint; b: bigint }
|
|
369
|
+
>
|
|
370
|
+
): Promise<TestContractResultWithoutMaps<bigint>> => {
|
|
371
|
+
return testMethod(this, "uqdiv", params, getContractByCodeHash);
|
|
372
|
+
},
|
|
373
|
+
sqrt: async (
|
|
374
|
+
params: TestContractParamsWithoutMaps<
|
|
375
|
+
TokenPairTypes.Fields,
|
|
376
|
+
{ y: bigint }
|
|
377
|
+
>
|
|
378
|
+
): Promise<TestContractResultWithoutMaps<bigint>> => {
|
|
379
|
+
return testMethod(this, "sqrt", params, getContractByCodeHash);
|
|
380
|
+
},
|
|
381
|
+
setFeeCollectorId: async (
|
|
382
|
+
params: TestContractParamsWithoutMaps<
|
|
383
|
+
TokenPairTypes.Fields,
|
|
384
|
+
{ id: HexString }
|
|
385
|
+
>
|
|
386
|
+
): Promise<TestContractResultWithoutMaps<null>> => {
|
|
387
|
+
return testMethod(
|
|
388
|
+
this,
|
|
389
|
+
"setFeeCollectorId",
|
|
390
|
+
params,
|
|
391
|
+
getContractByCodeHash
|
|
392
|
+
);
|
|
393
|
+
},
|
|
394
|
+
getTokenPair: async (
|
|
395
|
+
params: Omit<
|
|
396
|
+
TestContractParamsWithoutMaps<TokenPairTypes.Fields, never>,
|
|
397
|
+
"args"
|
|
398
|
+
>
|
|
399
|
+
): Promise<TestContractResultWithoutMaps<[HexString, HexString]>> => {
|
|
400
|
+
return testMethod(this, "getTokenPair", params, getContractByCodeHash);
|
|
401
|
+
},
|
|
402
|
+
getReserves: async (
|
|
403
|
+
params: Omit<
|
|
404
|
+
TestContractParamsWithoutMaps<TokenPairTypes.Fields, never>,
|
|
405
|
+
"args"
|
|
406
|
+
>
|
|
407
|
+
): Promise<TestContractResultWithoutMaps<[bigint, bigint]>> => {
|
|
408
|
+
return testMethod(this, "getReserves", params, getContractByCodeHash);
|
|
409
|
+
},
|
|
410
|
+
getBlockTimeStampLast: async (
|
|
411
|
+
params: Omit<
|
|
412
|
+
TestContractParamsWithoutMaps<TokenPairTypes.Fields, never>,
|
|
413
|
+
"args"
|
|
414
|
+
>
|
|
415
|
+
): Promise<TestContractResultWithoutMaps<bigint>> => {
|
|
416
|
+
return testMethod(
|
|
417
|
+
this,
|
|
418
|
+
"getBlockTimeStampLast",
|
|
419
|
+
params,
|
|
420
|
+
getContractByCodeHash
|
|
421
|
+
);
|
|
422
|
+
},
|
|
423
|
+
getPrice0CumulativeLast: async (
|
|
424
|
+
params: Omit<
|
|
425
|
+
TestContractParamsWithoutMaps<TokenPairTypes.Fields, never>,
|
|
426
|
+
"args"
|
|
427
|
+
>
|
|
428
|
+
): Promise<TestContractResultWithoutMaps<bigint>> => {
|
|
429
|
+
return testMethod(
|
|
430
|
+
this,
|
|
431
|
+
"getPrice0CumulativeLast",
|
|
432
|
+
params,
|
|
433
|
+
getContractByCodeHash
|
|
434
|
+
);
|
|
435
|
+
},
|
|
436
|
+
getPrice1CumulativeLast: async (
|
|
437
|
+
params: Omit<
|
|
438
|
+
TestContractParamsWithoutMaps<TokenPairTypes.Fields, never>,
|
|
439
|
+
"args"
|
|
440
|
+
>
|
|
441
|
+
): Promise<TestContractResultWithoutMaps<bigint>> => {
|
|
442
|
+
return testMethod(
|
|
443
|
+
this,
|
|
444
|
+
"getPrice1CumulativeLast",
|
|
445
|
+
params,
|
|
446
|
+
getContractByCodeHash
|
|
447
|
+
);
|
|
448
|
+
},
|
|
449
|
+
update: async (
|
|
450
|
+
params: TestContractParamsWithoutMaps<
|
|
451
|
+
TokenPairTypes.Fields,
|
|
452
|
+
{ newReserve0: bigint; newReserve1: bigint }
|
|
453
|
+
>
|
|
454
|
+
): Promise<TestContractResultWithoutMaps<null>> => {
|
|
455
|
+
return testMethod(this, "update", params, getContractByCodeHash);
|
|
456
|
+
},
|
|
457
|
+
mintFee: async (
|
|
458
|
+
params: TestContractParamsWithoutMaps<
|
|
459
|
+
TokenPairTypes.Fields,
|
|
460
|
+
{ reserve0_: bigint; reserve1_: bigint }
|
|
461
|
+
>
|
|
462
|
+
): Promise<TestContractResultWithoutMaps<[boolean, bigint]>> => {
|
|
463
|
+
return testMethod(this, "mintFee", params, getContractByCodeHash);
|
|
464
|
+
},
|
|
465
|
+
mint: async (
|
|
466
|
+
params: TestContractParamsWithoutMaps<
|
|
467
|
+
TokenPairTypes.Fields,
|
|
468
|
+
{ sender: Address; amount0: bigint; amount1: bigint }
|
|
469
|
+
>
|
|
470
|
+
): Promise<TestContractResultWithoutMaps<bigint>> => {
|
|
471
|
+
return testMethod(this, "mint", params, getContractByCodeHash);
|
|
472
|
+
},
|
|
473
|
+
burn: async (
|
|
474
|
+
params: TestContractParamsWithoutMaps<
|
|
475
|
+
TokenPairTypes.Fields,
|
|
476
|
+
{ sender: Address; liquidity: bigint }
|
|
477
|
+
>
|
|
478
|
+
): Promise<TestContractResultWithoutMaps<[bigint, bigint]>> => {
|
|
479
|
+
return testMethod(this, "burn", params, getContractByCodeHash);
|
|
480
|
+
},
|
|
481
|
+
swap: async (
|
|
482
|
+
params: TestContractParamsWithoutMaps<
|
|
483
|
+
TokenPairTypes.Fields,
|
|
484
|
+
{
|
|
485
|
+
sender: Address;
|
|
486
|
+
to: Address;
|
|
487
|
+
amount0In: bigint;
|
|
488
|
+
amount1In: bigint;
|
|
489
|
+
amount0Out: bigint;
|
|
490
|
+
amount1Out: bigint;
|
|
491
|
+
}
|
|
492
|
+
>
|
|
493
|
+
): Promise<TestContractResultWithoutMaps<null>> => {
|
|
494
|
+
return testMethod(this, "swap", params, getContractByCodeHash);
|
|
495
|
+
},
|
|
496
|
+
collectFeeManually: async (
|
|
497
|
+
params: Omit<
|
|
498
|
+
TestContractParamsWithoutMaps<TokenPairTypes.Fields, never>,
|
|
499
|
+
"args"
|
|
500
|
+
>
|
|
501
|
+
): Promise<TestContractResultWithoutMaps<null>> => {
|
|
502
|
+
return testMethod(
|
|
503
|
+
this,
|
|
504
|
+
"collectFeeManually",
|
|
505
|
+
params,
|
|
506
|
+
getContractByCodeHash
|
|
507
|
+
);
|
|
508
|
+
},
|
|
509
|
+
collectFeeAndUpdateKLast: async (
|
|
510
|
+
params: TestContractParamsWithoutMaps<
|
|
511
|
+
TokenPairTypes.Fields,
|
|
512
|
+
{ feeAmount: bigint }
|
|
513
|
+
>
|
|
514
|
+
): Promise<TestContractResultWithoutMaps<null>> => {
|
|
515
|
+
return testMethod(
|
|
516
|
+
this,
|
|
517
|
+
"collectFeeAndUpdateKLast",
|
|
518
|
+
params,
|
|
519
|
+
getContractByCodeHash
|
|
520
|
+
);
|
|
521
|
+
},
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
stateForTest(
|
|
525
|
+
initFields: TokenPairTypes.Fields,
|
|
526
|
+
asset?: Asset,
|
|
527
|
+
address?: string
|
|
528
|
+
) {
|
|
529
|
+
return this.stateForTest_(initFields, asset, address, undefined);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// Use this object to test and deploy the contract
|
|
534
|
+
export const TokenPair = new Factory(
|
|
535
|
+
Contract.fromJson(
|
|
536
|
+
TokenPairContractJson,
|
|
537
|
+
"",
|
|
538
|
+
"3a4ac01ae47b1c84a567e7ef467fc4f7f8e5da32c6546192f0e2b2af3d79891f",
|
|
539
|
+
[]
|
|
540
|
+
)
|
|
541
|
+
);
|
|
542
|
+
registerContract(TokenPair);
|
|
543
|
+
|
|
544
|
+
// Use this class to interact with the blockchain
|
|
545
|
+
export class TokenPairInstance extends ContractInstance {
|
|
546
|
+
constructor(address: Address) {
|
|
547
|
+
super(address);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
async fetchState(): Promise<TokenPairTypes.State> {
|
|
551
|
+
return fetchContractState(TokenPair, this);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
async getContractEventsCurrentCount(): Promise<number> {
|
|
555
|
+
return getContractEventsCurrentCount(this.address);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
subscribeMintEvent(
|
|
559
|
+
options: EventSubscribeOptions<TokenPairTypes.MintEvent>,
|
|
560
|
+
fromCount?: number
|
|
561
|
+
): EventSubscription {
|
|
562
|
+
return subscribeContractEvent(
|
|
563
|
+
TokenPair.contract,
|
|
564
|
+
this,
|
|
565
|
+
options,
|
|
566
|
+
"Mint",
|
|
567
|
+
fromCount
|
|
568
|
+
);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
subscribeBurnEvent(
|
|
572
|
+
options: EventSubscribeOptions<TokenPairTypes.BurnEvent>,
|
|
573
|
+
fromCount?: number
|
|
574
|
+
): EventSubscription {
|
|
575
|
+
return subscribeContractEvent(
|
|
576
|
+
TokenPair.contract,
|
|
577
|
+
this,
|
|
578
|
+
options,
|
|
579
|
+
"Burn",
|
|
580
|
+
fromCount
|
|
581
|
+
);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
subscribeSwapEvent(
|
|
585
|
+
options: EventSubscribeOptions<TokenPairTypes.SwapEvent>,
|
|
586
|
+
fromCount?: number
|
|
587
|
+
): EventSubscription {
|
|
588
|
+
return subscribeContractEvent(
|
|
589
|
+
TokenPair.contract,
|
|
590
|
+
this,
|
|
591
|
+
options,
|
|
592
|
+
"Swap",
|
|
593
|
+
fromCount
|
|
594
|
+
);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
subscribeAllEvents(
|
|
598
|
+
options: EventSubscribeOptions<
|
|
599
|
+
| TokenPairTypes.MintEvent
|
|
600
|
+
| TokenPairTypes.BurnEvent
|
|
601
|
+
| TokenPairTypes.SwapEvent
|
|
602
|
+
>,
|
|
603
|
+
fromCount?: number
|
|
604
|
+
): EventSubscription {
|
|
605
|
+
return subscribeContractEvents(
|
|
606
|
+
TokenPair.contract,
|
|
607
|
+
this,
|
|
608
|
+
options,
|
|
609
|
+
fromCount
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
view = {
|
|
614
|
+
getSymbol: async (
|
|
615
|
+
params?: TokenPairTypes.CallMethodParams<"getSymbol">
|
|
616
|
+
): Promise<TokenPairTypes.CallMethodResult<"getSymbol">> => {
|
|
617
|
+
return callMethod(
|
|
618
|
+
TokenPair,
|
|
619
|
+
this,
|
|
620
|
+
"getSymbol",
|
|
621
|
+
params === undefined ? {} : params,
|
|
622
|
+
getContractByCodeHash
|
|
623
|
+
);
|
|
624
|
+
},
|
|
625
|
+
getName: async (
|
|
626
|
+
params?: TokenPairTypes.CallMethodParams<"getName">
|
|
627
|
+
): Promise<TokenPairTypes.CallMethodResult<"getName">> => {
|
|
628
|
+
return callMethod(
|
|
629
|
+
TokenPair,
|
|
630
|
+
this,
|
|
631
|
+
"getName",
|
|
632
|
+
params === undefined ? {} : params,
|
|
633
|
+
getContractByCodeHash
|
|
634
|
+
);
|
|
635
|
+
},
|
|
636
|
+
getDecimals: async (
|
|
637
|
+
params?: TokenPairTypes.CallMethodParams<"getDecimals">
|
|
638
|
+
): Promise<TokenPairTypes.CallMethodResult<"getDecimals">> => {
|
|
639
|
+
return callMethod(
|
|
640
|
+
TokenPair,
|
|
641
|
+
this,
|
|
642
|
+
"getDecimals",
|
|
643
|
+
params === undefined ? {} : params,
|
|
644
|
+
getContractByCodeHash
|
|
645
|
+
);
|
|
646
|
+
},
|
|
647
|
+
getTotalSupply: async (
|
|
648
|
+
params?: TokenPairTypes.CallMethodParams<"getTotalSupply">
|
|
649
|
+
): Promise<TokenPairTypes.CallMethodResult<"getTotalSupply">> => {
|
|
650
|
+
return callMethod(
|
|
651
|
+
TokenPair,
|
|
652
|
+
this,
|
|
653
|
+
"getTotalSupply",
|
|
654
|
+
params === undefined ? {} : params,
|
|
655
|
+
getContractByCodeHash
|
|
656
|
+
);
|
|
657
|
+
},
|
|
658
|
+
uqdiv: async (
|
|
659
|
+
params: TokenPairTypes.CallMethodParams<"uqdiv">
|
|
660
|
+
): Promise<TokenPairTypes.CallMethodResult<"uqdiv">> => {
|
|
661
|
+
return callMethod(
|
|
662
|
+
TokenPair,
|
|
663
|
+
this,
|
|
664
|
+
"uqdiv",
|
|
665
|
+
params,
|
|
666
|
+
getContractByCodeHash
|
|
667
|
+
);
|
|
668
|
+
},
|
|
669
|
+
sqrt: async (
|
|
670
|
+
params: TokenPairTypes.CallMethodParams<"sqrt">
|
|
671
|
+
): Promise<TokenPairTypes.CallMethodResult<"sqrt">> => {
|
|
672
|
+
return callMethod(TokenPair, this, "sqrt", params, getContractByCodeHash);
|
|
673
|
+
},
|
|
674
|
+
setFeeCollectorId: async (
|
|
675
|
+
params: TokenPairTypes.CallMethodParams<"setFeeCollectorId">
|
|
676
|
+
): Promise<TokenPairTypes.CallMethodResult<"setFeeCollectorId">> => {
|
|
677
|
+
return callMethod(
|
|
678
|
+
TokenPair,
|
|
679
|
+
this,
|
|
680
|
+
"setFeeCollectorId",
|
|
681
|
+
params,
|
|
682
|
+
getContractByCodeHash
|
|
683
|
+
);
|
|
684
|
+
},
|
|
685
|
+
getTokenPair: async (
|
|
686
|
+
params?: TokenPairTypes.CallMethodParams<"getTokenPair">
|
|
687
|
+
): Promise<TokenPairTypes.CallMethodResult<"getTokenPair">> => {
|
|
688
|
+
return callMethod(
|
|
689
|
+
TokenPair,
|
|
690
|
+
this,
|
|
691
|
+
"getTokenPair",
|
|
692
|
+
params === undefined ? {} : params,
|
|
693
|
+
getContractByCodeHash
|
|
694
|
+
);
|
|
695
|
+
},
|
|
696
|
+
getReserves: async (
|
|
697
|
+
params?: TokenPairTypes.CallMethodParams<"getReserves">
|
|
698
|
+
): Promise<TokenPairTypes.CallMethodResult<"getReserves">> => {
|
|
699
|
+
return callMethod(
|
|
700
|
+
TokenPair,
|
|
701
|
+
this,
|
|
702
|
+
"getReserves",
|
|
703
|
+
params === undefined ? {} : params,
|
|
704
|
+
getContractByCodeHash
|
|
705
|
+
);
|
|
706
|
+
},
|
|
707
|
+
getBlockTimeStampLast: async (
|
|
708
|
+
params?: TokenPairTypes.CallMethodParams<"getBlockTimeStampLast">
|
|
709
|
+
): Promise<TokenPairTypes.CallMethodResult<"getBlockTimeStampLast">> => {
|
|
710
|
+
return callMethod(
|
|
711
|
+
TokenPair,
|
|
712
|
+
this,
|
|
713
|
+
"getBlockTimeStampLast",
|
|
714
|
+
params === undefined ? {} : params,
|
|
715
|
+
getContractByCodeHash
|
|
716
|
+
);
|
|
717
|
+
},
|
|
718
|
+
getPrice0CumulativeLast: async (
|
|
719
|
+
params?: TokenPairTypes.CallMethodParams<"getPrice0CumulativeLast">
|
|
720
|
+
): Promise<TokenPairTypes.CallMethodResult<"getPrice0CumulativeLast">> => {
|
|
721
|
+
return callMethod(
|
|
722
|
+
TokenPair,
|
|
723
|
+
this,
|
|
724
|
+
"getPrice0CumulativeLast",
|
|
725
|
+
params === undefined ? {} : params,
|
|
726
|
+
getContractByCodeHash
|
|
727
|
+
);
|
|
728
|
+
},
|
|
729
|
+
getPrice1CumulativeLast: async (
|
|
730
|
+
params?: TokenPairTypes.CallMethodParams<"getPrice1CumulativeLast">
|
|
731
|
+
): Promise<TokenPairTypes.CallMethodResult<"getPrice1CumulativeLast">> => {
|
|
732
|
+
return callMethod(
|
|
733
|
+
TokenPair,
|
|
734
|
+
this,
|
|
735
|
+
"getPrice1CumulativeLast",
|
|
736
|
+
params === undefined ? {} : params,
|
|
737
|
+
getContractByCodeHash
|
|
738
|
+
);
|
|
739
|
+
},
|
|
740
|
+
update: async (
|
|
741
|
+
params: TokenPairTypes.CallMethodParams<"update">
|
|
742
|
+
): Promise<TokenPairTypes.CallMethodResult<"update">> => {
|
|
743
|
+
return callMethod(
|
|
744
|
+
TokenPair,
|
|
745
|
+
this,
|
|
746
|
+
"update",
|
|
747
|
+
params,
|
|
748
|
+
getContractByCodeHash
|
|
749
|
+
);
|
|
750
|
+
},
|
|
751
|
+
mintFee: async (
|
|
752
|
+
params: TokenPairTypes.CallMethodParams<"mintFee">
|
|
753
|
+
): Promise<TokenPairTypes.CallMethodResult<"mintFee">> => {
|
|
754
|
+
return callMethod(
|
|
755
|
+
TokenPair,
|
|
756
|
+
this,
|
|
757
|
+
"mintFee",
|
|
758
|
+
params,
|
|
759
|
+
getContractByCodeHash
|
|
760
|
+
);
|
|
761
|
+
},
|
|
762
|
+
mint: async (
|
|
763
|
+
params: TokenPairTypes.CallMethodParams<"mint">
|
|
764
|
+
): Promise<TokenPairTypes.CallMethodResult<"mint">> => {
|
|
765
|
+
return callMethod(TokenPair, this, "mint", params, getContractByCodeHash);
|
|
766
|
+
},
|
|
767
|
+
burn: async (
|
|
768
|
+
params: TokenPairTypes.CallMethodParams<"burn">
|
|
769
|
+
): Promise<TokenPairTypes.CallMethodResult<"burn">> => {
|
|
770
|
+
return callMethod(TokenPair, this, "burn", params, getContractByCodeHash);
|
|
771
|
+
},
|
|
772
|
+
swap: async (
|
|
773
|
+
params: TokenPairTypes.CallMethodParams<"swap">
|
|
774
|
+
): Promise<TokenPairTypes.CallMethodResult<"swap">> => {
|
|
775
|
+
return callMethod(TokenPair, this, "swap", params, getContractByCodeHash);
|
|
776
|
+
},
|
|
777
|
+
collectFeeManually: async (
|
|
778
|
+
params?: TokenPairTypes.CallMethodParams<"collectFeeManually">
|
|
779
|
+
): Promise<TokenPairTypes.CallMethodResult<"collectFeeManually">> => {
|
|
780
|
+
return callMethod(
|
|
781
|
+
TokenPair,
|
|
782
|
+
this,
|
|
783
|
+
"collectFeeManually",
|
|
784
|
+
params === undefined ? {} : params,
|
|
785
|
+
getContractByCodeHash
|
|
786
|
+
);
|
|
787
|
+
},
|
|
788
|
+
collectFeeAndUpdateKLast: async (
|
|
789
|
+
params: TokenPairTypes.CallMethodParams<"collectFeeAndUpdateKLast">
|
|
790
|
+
): Promise<TokenPairTypes.CallMethodResult<"collectFeeAndUpdateKLast">> => {
|
|
791
|
+
return callMethod(
|
|
792
|
+
TokenPair,
|
|
793
|
+
this,
|
|
794
|
+
"collectFeeAndUpdateKLast",
|
|
795
|
+
params,
|
|
796
|
+
getContractByCodeHash
|
|
797
|
+
);
|
|
798
|
+
},
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
transact = {
|
|
802
|
+
getSymbol: async (
|
|
803
|
+
params: TokenPairTypes.SignExecuteMethodParams<"getSymbol">
|
|
804
|
+
): Promise<TokenPairTypes.SignExecuteMethodResult<"getSymbol">> => {
|
|
805
|
+
return signExecuteMethod(TokenPair, this, "getSymbol", params);
|
|
806
|
+
},
|
|
807
|
+
getName: async (
|
|
808
|
+
params: TokenPairTypes.SignExecuteMethodParams<"getName">
|
|
809
|
+
): Promise<TokenPairTypes.SignExecuteMethodResult<"getName">> => {
|
|
810
|
+
return signExecuteMethod(TokenPair, this, "getName", params);
|
|
811
|
+
},
|
|
812
|
+
getDecimals: async (
|
|
813
|
+
params: TokenPairTypes.SignExecuteMethodParams<"getDecimals">
|
|
814
|
+
): Promise<TokenPairTypes.SignExecuteMethodResult<"getDecimals">> => {
|
|
815
|
+
return signExecuteMethod(TokenPair, this, "getDecimals", params);
|
|
816
|
+
},
|
|
817
|
+
getTotalSupply: async (
|
|
818
|
+
params: TokenPairTypes.SignExecuteMethodParams<"getTotalSupply">
|
|
819
|
+
): Promise<TokenPairTypes.SignExecuteMethodResult<"getTotalSupply">> => {
|
|
820
|
+
return signExecuteMethod(TokenPair, this, "getTotalSupply", params);
|
|
821
|
+
},
|
|
822
|
+
uqdiv: async (
|
|
823
|
+
params: TokenPairTypes.SignExecuteMethodParams<"uqdiv">
|
|
824
|
+
): Promise<TokenPairTypes.SignExecuteMethodResult<"uqdiv">> => {
|
|
825
|
+
return signExecuteMethod(TokenPair, this, "uqdiv", params);
|
|
826
|
+
},
|
|
827
|
+
sqrt: async (
|
|
828
|
+
params: TokenPairTypes.SignExecuteMethodParams<"sqrt">
|
|
829
|
+
): Promise<TokenPairTypes.SignExecuteMethodResult<"sqrt">> => {
|
|
830
|
+
return signExecuteMethod(TokenPair, this, "sqrt", params);
|
|
831
|
+
},
|
|
832
|
+
setFeeCollectorId: async (
|
|
833
|
+
params: TokenPairTypes.SignExecuteMethodParams<"setFeeCollectorId">
|
|
834
|
+
): Promise<TokenPairTypes.SignExecuteMethodResult<"setFeeCollectorId">> => {
|
|
835
|
+
return signExecuteMethod(TokenPair, this, "setFeeCollectorId", params);
|
|
836
|
+
},
|
|
837
|
+
getTokenPair: async (
|
|
838
|
+
params: TokenPairTypes.SignExecuteMethodParams<"getTokenPair">
|
|
839
|
+
): Promise<TokenPairTypes.SignExecuteMethodResult<"getTokenPair">> => {
|
|
840
|
+
return signExecuteMethod(TokenPair, this, "getTokenPair", params);
|
|
841
|
+
},
|
|
842
|
+
getReserves: async (
|
|
843
|
+
params: TokenPairTypes.SignExecuteMethodParams<"getReserves">
|
|
844
|
+
): Promise<TokenPairTypes.SignExecuteMethodResult<"getReserves">> => {
|
|
845
|
+
return signExecuteMethod(TokenPair, this, "getReserves", params);
|
|
846
|
+
},
|
|
847
|
+
getBlockTimeStampLast: async (
|
|
848
|
+
params: TokenPairTypes.SignExecuteMethodParams<"getBlockTimeStampLast">
|
|
849
|
+
): Promise<
|
|
850
|
+
TokenPairTypes.SignExecuteMethodResult<"getBlockTimeStampLast">
|
|
851
|
+
> => {
|
|
852
|
+
return signExecuteMethod(
|
|
853
|
+
TokenPair,
|
|
854
|
+
this,
|
|
855
|
+
"getBlockTimeStampLast",
|
|
856
|
+
params
|
|
857
|
+
);
|
|
858
|
+
},
|
|
859
|
+
getPrice0CumulativeLast: async (
|
|
860
|
+
params: TokenPairTypes.SignExecuteMethodParams<"getPrice0CumulativeLast">
|
|
861
|
+
): Promise<
|
|
862
|
+
TokenPairTypes.SignExecuteMethodResult<"getPrice0CumulativeLast">
|
|
863
|
+
> => {
|
|
864
|
+
return signExecuteMethod(
|
|
865
|
+
TokenPair,
|
|
866
|
+
this,
|
|
867
|
+
"getPrice0CumulativeLast",
|
|
868
|
+
params
|
|
869
|
+
);
|
|
870
|
+
},
|
|
871
|
+
getPrice1CumulativeLast: async (
|
|
872
|
+
params: TokenPairTypes.SignExecuteMethodParams<"getPrice1CumulativeLast">
|
|
873
|
+
): Promise<
|
|
874
|
+
TokenPairTypes.SignExecuteMethodResult<"getPrice1CumulativeLast">
|
|
875
|
+
> => {
|
|
876
|
+
return signExecuteMethod(
|
|
877
|
+
TokenPair,
|
|
878
|
+
this,
|
|
879
|
+
"getPrice1CumulativeLast",
|
|
880
|
+
params
|
|
881
|
+
);
|
|
882
|
+
},
|
|
883
|
+
update: async (
|
|
884
|
+
params: TokenPairTypes.SignExecuteMethodParams<"update">
|
|
885
|
+
): Promise<TokenPairTypes.SignExecuteMethodResult<"update">> => {
|
|
886
|
+
return signExecuteMethod(TokenPair, this, "update", params);
|
|
887
|
+
},
|
|
888
|
+
mintFee: async (
|
|
889
|
+
params: TokenPairTypes.SignExecuteMethodParams<"mintFee">
|
|
890
|
+
): Promise<TokenPairTypes.SignExecuteMethodResult<"mintFee">> => {
|
|
891
|
+
return signExecuteMethod(TokenPair, this, "mintFee", params);
|
|
892
|
+
},
|
|
893
|
+
mint: async (
|
|
894
|
+
params: TokenPairTypes.SignExecuteMethodParams<"mint">
|
|
895
|
+
): Promise<TokenPairTypes.SignExecuteMethodResult<"mint">> => {
|
|
896
|
+
return signExecuteMethod(TokenPair, this, "mint", params);
|
|
897
|
+
},
|
|
898
|
+
burn: async (
|
|
899
|
+
params: TokenPairTypes.SignExecuteMethodParams<"burn">
|
|
900
|
+
): Promise<TokenPairTypes.SignExecuteMethodResult<"burn">> => {
|
|
901
|
+
return signExecuteMethod(TokenPair, this, "burn", params);
|
|
902
|
+
},
|
|
903
|
+
swap: async (
|
|
904
|
+
params: TokenPairTypes.SignExecuteMethodParams<"swap">
|
|
905
|
+
): Promise<TokenPairTypes.SignExecuteMethodResult<"swap">> => {
|
|
906
|
+
return signExecuteMethod(TokenPair, this, "swap", params);
|
|
907
|
+
},
|
|
908
|
+
collectFeeManually: async (
|
|
909
|
+
params: TokenPairTypes.SignExecuteMethodParams<"collectFeeManually">
|
|
910
|
+
): Promise<
|
|
911
|
+
TokenPairTypes.SignExecuteMethodResult<"collectFeeManually">
|
|
912
|
+
> => {
|
|
913
|
+
return signExecuteMethod(TokenPair, this, "collectFeeManually", params);
|
|
914
|
+
},
|
|
915
|
+
collectFeeAndUpdateKLast: async (
|
|
916
|
+
params: TokenPairTypes.SignExecuteMethodParams<"collectFeeAndUpdateKLast">
|
|
917
|
+
): Promise<
|
|
918
|
+
TokenPairTypes.SignExecuteMethodResult<"collectFeeAndUpdateKLast">
|
|
919
|
+
> => {
|
|
920
|
+
return signExecuteMethod(
|
|
921
|
+
TokenPair,
|
|
922
|
+
this,
|
|
923
|
+
"collectFeeAndUpdateKLast",
|
|
924
|
+
params
|
|
925
|
+
);
|
|
926
|
+
},
|
|
927
|
+
};
|
|
928
|
+
|
|
929
|
+
async multicall<Calls extends TokenPairTypes.MultiCallParams>(
|
|
930
|
+
calls: Calls
|
|
931
|
+
): Promise<TokenPairTypes.MultiCallResults<Calls>>;
|
|
932
|
+
async multicall<Callss extends TokenPairTypes.MultiCallParams[]>(
|
|
933
|
+
callss: Narrow<Callss>
|
|
934
|
+
): Promise<TokenPairTypes.MulticallReturnType<Callss>>;
|
|
935
|
+
async multicall<
|
|
936
|
+
Callss extends
|
|
937
|
+
| TokenPairTypes.MultiCallParams
|
|
938
|
+
| TokenPairTypes.MultiCallParams[]
|
|
939
|
+
>(callss: Callss): Promise<unknown> {
|
|
940
|
+
return await multicallMethods(
|
|
941
|
+
TokenPair,
|
|
942
|
+
this,
|
|
943
|
+
callss,
|
|
944
|
+
getContractByCodeHash
|
|
945
|
+
);
|
|
946
|
+
}
|
|
947
|
+
}
|