@dodoex/dodo-contract-request 1.6.0 → 1.7.0-alpha.2
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/.cache/contract-info/UniswapV2FactoryFixedFee.json +1 -0
- package/.cache/contract-info/UniswapV2Router02FixedFee.json +1 -0
- package/CHANGELOG.md +65 -19
- package/contract-config/plume.json +67 -0
- package/contract-config/sepolia.json +5 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/types/config/index.d.ts +31 -0
- package/dist/types/config/plume.d.ts +31 -0
- package/dist/types/config/sepolia.d.ts +2 -0
- package/dist/types/contract/UniswapV2FactoryFixedFee.d.ts +78 -0
- package/dist/types/contract/UniswapV2Router02FixedFee.d.ts +282 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +2 -2
- package/src/config/index.ts +5 -1
- package/src/config/plume.ts +4 -0
- package/src/config/sepolia.ts +1 -1
- package/src/contract/CrowdPoolingFactory.ts +1 -1
- package/src/contract/DODOApprove.ts +1 -1
- package/src/contract/DODOApproveProxy.ts +1 -1
- package/src/contract/DODOCalleeHelper.ts +1 -1
- package/src/contract/DODOCpProxy.ts +1 -1
- package/src/contract/DODODppProxy.ts +1 -1
- package/src/contract/DODODspProxyWithoutGSP.ts +1 -1
- package/src/contract/DODOMineV2Factory.ts +1 -1
- package/src/contract/DODOMineV3Proxy.ts +1 -1
- package/src/contract/DODOMineV3Registry.ts +1 -1
- package/src/contract/DODOSellHelper.ts +1 -1
- package/src/contract/DODOV1PmmHelper.ts +1 -1
- package/src/contract/DODOV2Proxy02.ts +1 -1
- package/src/contract/DODOV2RouteHelper.ts +1 -1
- package/src/contract/DPPFactory.ts +1 -1
- package/src/contract/DSPFactory.ts +1 -1
- package/src/contract/DVMFactory.ts +1 -1
- package/src/contract/ERC20Helper.ts +1 -1
- package/src/contract/ERC20V3Factory.ts +1 -1
- package/src/contract/GSPFactory.ts +1 -1
- package/src/contract/MulticallWithValid.ts +1 -1
- package/src/contract/UniswapV2FactoryFixedFee.ts +154 -0
- package/src/contract/UniswapV2Router02FixedFee.ts +436 -0
- package/src/index.ts +2 -0
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
import { defaultAbiCoder, concat, hexlify } from '@dodoex/contract-request';
|
|
2
|
+
|
|
3
|
+
import { contractRequests } from '../contractRequests';
|
|
4
|
+
|
|
5
|
+
export function getUniswapV2Router02FixedFeeContractAddressByChainId(chainId: number) {
|
|
6
|
+
const contractAddressObject = {"98865":"0x2Da0855f04919D402Af88D0D04AbB38177FE47fa","11155111":"0xeE567Fe1712Faf6149d80dA1E6934E354124CfE3"};
|
|
7
|
+
const result = contractAddressObject[String(chainId) as keyof typeof contractAddressObject];
|
|
8
|
+
if (!result) throw new Error(`Not support ChainId: ${chainId}.`)
|
|
9
|
+
return result
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* fetch WETH
|
|
14
|
+
* @param {number} chainId - number
|
|
15
|
+
* @returns {string} __output0 - address
|
|
16
|
+
*/
|
|
17
|
+
export function fetchUniswapV2Router02FixedFeeWETH(chainId: number): Promise<string> {
|
|
18
|
+
const __to = getUniswapV2Router02FixedFeeContractAddressByChainId(chainId);
|
|
19
|
+
|
|
20
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
21
|
+
const __data = hexlify(concat(['0xad5c4648', __encodeData]));
|
|
22
|
+
return contractRequests.batchCall<string>(chainId, __to, __data, [{"internalType":"address","name":"","type":"address"}])
|
|
23
|
+
}
|
|
24
|
+
export function getFetchUniswapV2Router02FixedFeeWETHQueryOptions(chainId: number | undefined) {
|
|
25
|
+
return {
|
|
26
|
+
queryKey: ['contract-request', chainId],
|
|
27
|
+
enabled: chainId !== undefined && chainId !== null,
|
|
28
|
+
queryFn: () => {
|
|
29
|
+
return fetchUniswapV2Router02FixedFeeWETH(chainId as number);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* fetch factory
|
|
36
|
+
* @param {number} chainId - number
|
|
37
|
+
* @returns {string} __output0 - address
|
|
38
|
+
*/
|
|
39
|
+
export function fetchUniswapV2Router02FixedFeeFactory(chainId: number): Promise<string> {
|
|
40
|
+
const __to = getUniswapV2Router02FixedFeeContractAddressByChainId(chainId);
|
|
41
|
+
|
|
42
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
43
|
+
const __data = hexlify(concat(['0xc45a0155', __encodeData]));
|
|
44
|
+
return contractRequests.batchCall<string>(chainId, __to, __data, [{"internalType":"address","name":"","type":"address"}])
|
|
45
|
+
}
|
|
46
|
+
export function getFetchUniswapV2Router02FixedFeeFactoryQueryOptions(chainId: number | undefined) {
|
|
47
|
+
return {
|
|
48
|
+
queryKey: ['contract-request', chainId],
|
|
49
|
+
enabled: chainId !== undefined && chainId !== null,
|
|
50
|
+
queryFn: () => {
|
|
51
|
+
return fetchUniswapV2Router02FixedFeeFactory(chainId as number);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* fetch getAmountIn
|
|
58
|
+
* @param {number} chainId - number
|
|
59
|
+
* @param {number} amountOut - uint256
|
|
60
|
+
* @param {number} reserveIn - uint256
|
|
61
|
+
* @param {number} reserveOut - uint256
|
|
62
|
+
* @returns {bigint} amountIn - uint256
|
|
63
|
+
*/
|
|
64
|
+
export function fetchUniswapV2Router02FixedFeeGetAmountIn(chainId: number, amountOut: number, reserveIn: number, reserveOut: number): Promise<bigint> {
|
|
65
|
+
const __to = getUniswapV2Router02FixedFeeContractAddressByChainId(chainId);
|
|
66
|
+
|
|
67
|
+
const __encodeData = defaultAbiCoder.encode(["uint256","uint256","uint256"], [amountOut,reserveIn,reserveOut]);
|
|
68
|
+
const __data = hexlify(concat(['0x85f8c259', __encodeData]));
|
|
69
|
+
return contractRequests.batchCall<bigint>(chainId, __to, __data, [{"internalType":"uint256","name":"amountIn","type":"uint256"}])
|
|
70
|
+
}
|
|
71
|
+
export function getFetchUniswapV2Router02FixedFeeGetAmountInQueryOptions(chainId: number | undefined, amountOut: number | undefined, reserveIn: number | undefined, reserveOut: number | undefined) {
|
|
72
|
+
return {
|
|
73
|
+
queryKey: ['contract-request', chainId, amountOut, reserveIn, reserveOut],
|
|
74
|
+
enabled: chainId !== undefined && chainId !== null && amountOut !== undefined && amountOut !== null && reserveIn !== undefined && reserveIn !== null && reserveOut !== undefined && reserveOut !== null,
|
|
75
|
+
queryFn: () => {
|
|
76
|
+
return fetchUniswapV2Router02FixedFeeGetAmountIn(chainId as number,amountOut as number,reserveIn as number,reserveOut as number);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* fetch getAmountOut
|
|
83
|
+
* @param {number} chainId - number
|
|
84
|
+
* @param {number} amountIn - uint256
|
|
85
|
+
* @param {number} reserveIn - uint256
|
|
86
|
+
* @param {number} reserveOut - uint256
|
|
87
|
+
* @returns {bigint} amountOut - uint256
|
|
88
|
+
*/
|
|
89
|
+
export function fetchUniswapV2Router02FixedFeeGetAmountOut(chainId: number, amountIn: number, reserveIn: number, reserveOut: number): Promise<bigint> {
|
|
90
|
+
const __to = getUniswapV2Router02FixedFeeContractAddressByChainId(chainId);
|
|
91
|
+
|
|
92
|
+
const __encodeData = defaultAbiCoder.encode(["uint256","uint256","uint256"], [amountIn,reserveIn,reserveOut]);
|
|
93
|
+
const __data = hexlify(concat(['0x054d50d4', __encodeData]));
|
|
94
|
+
return contractRequests.batchCall<bigint>(chainId, __to, __data, [{"internalType":"uint256","name":"amountOut","type":"uint256"}])
|
|
95
|
+
}
|
|
96
|
+
export function getFetchUniswapV2Router02FixedFeeGetAmountOutQueryOptions(chainId: number | undefined, amountIn: number | undefined, reserveIn: number | undefined, reserveOut: number | undefined) {
|
|
97
|
+
return {
|
|
98
|
+
queryKey: ['contract-request', chainId, amountIn, reserveIn, reserveOut],
|
|
99
|
+
enabled: chainId !== undefined && chainId !== null && amountIn !== undefined && amountIn !== null && reserveIn !== undefined && reserveIn !== null && reserveOut !== undefined && reserveOut !== null,
|
|
100
|
+
queryFn: () => {
|
|
101
|
+
return fetchUniswapV2Router02FixedFeeGetAmountOut(chainId as number,amountIn as number,reserveIn as number,reserveOut as number);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* fetch getAmountsIn
|
|
108
|
+
* @param {number} chainId - number
|
|
109
|
+
* @param {number} amountOut - uint256
|
|
110
|
+
* @param {Array<string>} path - address[]
|
|
111
|
+
* @returns {Array<bigint>} amounts - uint256[]
|
|
112
|
+
*/
|
|
113
|
+
export function fetchUniswapV2Router02FixedFeeGetAmountsIn(chainId: number, amountOut: number, path: Array<string>): Promise<Array<bigint>> {
|
|
114
|
+
const __to = getUniswapV2Router02FixedFeeContractAddressByChainId(chainId);
|
|
115
|
+
|
|
116
|
+
const __encodeData = defaultAbiCoder.encode(["uint256","address[]"], [amountOut,path]);
|
|
117
|
+
const __data = hexlify(concat(['0x1f00ca74', __encodeData]));
|
|
118
|
+
return contractRequests.batchCall<Array<bigint>>(chainId, __to, __data, [{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}])
|
|
119
|
+
}
|
|
120
|
+
export function getFetchUniswapV2Router02FixedFeeGetAmountsInQueryOptions(chainId: number | undefined, amountOut: number | undefined, path: Array<string> | undefined) {
|
|
121
|
+
return {
|
|
122
|
+
queryKey: ['contract-request', chainId, amountOut, path],
|
|
123
|
+
enabled: chainId !== undefined && chainId !== null && amountOut !== undefined && amountOut !== null && path !== undefined && path !== null,
|
|
124
|
+
queryFn: () => {
|
|
125
|
+
return fetchUniswapV2Router02FixedFeeGetAmountsIn(chainId as number,amountOut as number,path as Array<string>);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* fetch getAmountsOut
|
|
132
|
+
* @param {number} chainId - number
|
|
133
|
+
* @param {number} amountIn - uint256
|
|
134
|
+
* @param {Array<string>} path - address[]
|
|
135
|
+
* @returns {Array<bigint>} amounts - uint256[]
|
|
136
|
+
*/
|
|
137
|
+
export function fetchUniswapV2Router02FixedFeeGetAmountsOut(chainId: number, amountIn: number, path: Array<string>): Promise<Array<bigint>> {
|
|
138
|
+
const __to = getUniswapV2Router02FixedFeeContractAddressByChainId(chainId);
|
|
139
|
+
|
|
140
|
+
const __encodeData = defaultAbiCoder.encode(["uint256","address[]"], [amountIn,path]);
|
|
141
|
+
const __data = hexlify(concat(['0xd06ca61f', __encodeData]));
|
|
142
|
+
return contractRequests.batchCall<Array<bigint>>(chainId, __to, __data, [{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}])
|
|
143
|
+
}
|
|
144
|
+
export function getFetchUniswapV2Router02FixedFeeGetAmountsOutQueryOptions(chainId: number | undefined, amountIn: number | undefined, path: Array<string> | undefined) {
|
|
145
|
+
return {
|
|
146
|
+
queryKey: ['contract-request', chainId, amountIn, path],
|
|
147
|
+
enabled: chainId !== undefined && chainId !== null && amountIn !== undefined && amountIn !== null && path !== undefined && path !== null,
|
|
148
|
+
queryFn: () => {
|
|
149
|
+
return fetchUniswapV2Router02FixedFeeGetAmountsOut(chainId as number,amountIn as number,path as Array<string>);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* fetch quote
|
|
156
|
+
* @param {number} chainId - number
|
|
157
|
+
* @param {number} amountA - uint256
|
|
158
|
+
* @param {number} reserveA - uint256
|
|
159
|
+
* @param {number} reserveB - uint256
|
|
160
|
+
* @returns {bigint} amountB - uint256
|
|
161
|
+
*/
|
|
162
|
+
export function fetchUniswapV2Router02FixedFeeQuote(chainId: number, amountA: number, reserveA: number, reserveB: number): Promise<bigint> {
|
|
163
|
+
const __to = getUniswapV2Router02FixedFeeContractAddressByChainId(chainId);
|
|
164
|
+
|
|
165
|
+
const __encodeData = defaultAbiCoder.encode(["uint256","uint256","uint256"], [amountA,reserveA,reserveB]);
|
|
166
|
+
const __data = hexlify(concat(['0xad615dec', __encodeData]));
|
|
167
|
+
return contractRequests.batchCall<bigint>(chainId, __to, __data, [{"internalType":"uint256","name":"amountB","type":"uint256"}])
|
|
168
|
+
}
|
|
169
|
+
export function getFetchUniswapV2Router02FixedFeeQuoteQueryOptions(chainId: number | undefined, amountA: number | undefined, reserveA: number | undefined, reserveB: number | undefined) {
|
|
170
|
+
return {
|
|
171
|
+
queryKey: ['contract-request', chainId, amountA, reserveA, reserveB],
|
|
172
|
+
enabled: chainId !== undefined && chainId !== null && amountA !== undefined && amountA !== null && reserveA !== undefined && reserveA !== null && reserveB !== undefined && reserveB !== null,
|
|
173
|
+
queryFn: () => {
|
|
174
|
+
return fetchUniswapV2Router02FixedFeeQuote(chainId as number,amountA as number,reserveA as number,reserveB as number);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* encode addLiquidity
|
|
181
|
+
* @param {string} tokenA - address
|
|
182
|
+
* @param {string} tokenB - address
|
|
183
|
+
* @param {string | number} amountADesired - uint256
|
|
184
|
+
* @param {string | number} amountBDesired - uint256
|
|
185
|
+
* @param {string | number} amountAMin - uint256
|
|
186
|
+
* @param {string | number} amountBMin - uint256
|
|
187
|
+
* @param {string} to - address
|
|
188
|
+
* @param {string | number} deadline - uint256
|
|
189
|
+
* @returns {string} encode data
|
|
190
|
+
*/
|
|
191
|
+
export function encodeUniswapV2Router02FixedFeeAddLiquidity(tokenA: string, tokenB: string, amountADesired: string | number, amountBDesired: string | number, amountAMin: string | number, amountBMin: string | number, to: string, deadline: string | number) {
|
|
192
|
+
const __encodeData = defaultAbiCoder.encode(["address","address","uint256","uint256","uint256","uint256","address","uint256"], [tokenA,tokenB,amountADesired,amountBDesired,amountAMin,amountBMin,to,deadline]);
|
|
193
|
+
return hexlify(concat(['0xe8e33700', __encodeData]));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* encode addLiquidityETH
|
|
198
|
+
* @param {string} token - address
|
|
199
|
+
* @param {string | number} amountTokenDesired - uint256
|
|
200
|
+
* @param {string | number} amountTokenMin - uint256
|
|
201
|
+
* @param {string | number} amountETHMin - uint256
|
|
202
|
+
* @param {string} to - address
|
|
203
|
+
* @param {string | number} deadline - uint256
|
|
204
|
+
* @returns {string} encode data
|
|
205
|
+
*/
|
|
206
|
+
export function encodeUniswapV2Router02FixedFeeAddLiquidityETH(token: string, amountTokenDesired: string | number, amountTokenMin: string | number, amountETHMin: string | number, to: string, deadline: string | number) {
|
|
207
|
+
const __encodeData = defaultAbiCoder.encode(["address","uint256","uint256","uint256","address","uint256"], [token,amountTokenDesired,amountTokenMin,amountETHMin,to,deadline]);
|
|
208
|
+
return hexlify(concat(['0xf305d719', __encodeData]));
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* encode removeLiquidity
|
|
213
|
+
* @param {string} tokenA - address
|
|
214
|
+
* @param {string} tokenB - address
|
|
215
|
+
* @param {string | number} liquidity - uint256
|
|
216
|
+
* @param {string | number} amountAMin - uint256
|
|
217
|
+
* @param {string | number} amountBMin - uint256
|
|
218
|
+
* @param {string} to - address
|
|
219
|
+
* @param {string | number} deadline - uint256
|
|
220
|
+
* @returns {string} encode data
|
|
221
|
+
*/
|
|
222
|
+
export function encodeUniswapV2Router02FixedFeeRemoveLiquidity(tokenA: string, tokenB: string, liquidity: string | number, amountAMin: string | number, amountBMin: string | number, to: string, deadline: string | number) {
|
|
223
|
+
const __encodeData = defaultAbiCoder.encode(["address","address","uint256","uint256","uint256","address","uint256"], [tokenA,tokenB,liquidity,amountAMin,amountBMin,to,deadline]);
|
|
224
|
+
return hexlify(concat(['0xbaa2abde', __encodeData]));
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* encode removeLiquidityETH
|
|
229
|
+
* @param {string} token - address
|
|
230
|
+
* @param {string | number} liquidity - uint256
|
|
231
|
+
* @param {string | number} amountTokenMin - uint256
|
|
232
|
+
* @param {string | number} amountETHMin - uint256
|
|
233
|
+
* @param {string} to - address
|
|
234
|
+
* @param {string | number} deadline - uint256
|
|
235
|
+
* @returns {string} encode data
|
|
236
|
+
*/
|
|
237
|
+
export function encodeUniswapV2Router02FixedFeeRemoveLiquidityETH(token: string, liquidity: string | number, amountTokenMin: string | number, amountETHMin: string | number, to: string, deadline: string | number) {
|
|
238
|
+
const __encodeData = defaultAbiCoder.encode(["address","uint256","uint256","uint256","address","uint256"], [token,liquidity,amountTokenMin,amountETHMin,to,deadline]);
|
|
239
|
+
return hexlify(concat(['0x02751cec', __encodeData]));
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* encode removeLiquidityETHSupportingFeeOnTransferTokens
|
|
244
|
+
* @param {string} token - address
|
|
245
|
+
* @param {string | number} liquidity - uint256
|
|
246
|
+
* @param {string | number} amountTokenMin - uint256
|
|
247
|
+
* @param {string | number} amountETHMin - uint256
|
|
248
|
+
* @param {string} to - address
|
|
249
|
+
* @param {string | number} deadline - uint256
|
|
250
|
+
* @returns {string} encode data
|
|
251
|
+
*/
|
|
252
|
+
export function encodeUniswapV2Router02FixedFeeRemoveLiquidityETHSupportingFeeOnTransferTokens(token: string, liquidity: string | number, amountTokenMin: string | number, amountETHMin: string | number, to: string, deadline: string | number) {
|
|
253
|
+
const __encodeData = defaultAbiCoder.encode(["address","uint256","uint256","uint256","address","uint256"], [token,liquidity,amountTokenMin,amountETHMin,to,deadline]);
|
|
254
|
+
return hexlify(concat(['0xaf2979eb', __encodeData]));
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* encode removeLiquidityETHWithPermit
|
|
259
|
+
* @param {string} token - address
|
|
260
|
+
* @param {string | number} liquidity - uint256
|
|
261
|
+
* @param {string | number} amountTokenMin - uint256
|
|
262
|
+
* @param {string | number} amountETHMin - uint256
|
|
263
|
+
* @param {string} to - address
|
|
264
|
+
* @param {string | number} deadline - uint256
|
|
265
|
+
* @param {boolean} approveMax - bool
|
|
266
|
+
* @param {string | number} v - uint8
|
|
267
|
+
* @param {string} r - bytes32
|
|
268
|
+
* @param {string} s - bytes32
|
|
269
|
+
* @returns {string} encode data
|
|
270
|
+
*/
|
|
271
|
+
export function encodeUniswapV2Router02FixedFeeRemoveLiquidityETHWithPermit(token: string, liquidity: string | number, amountTokenMin: string | number, amountETHMin: string | number, to: string, deadline: string | number, approveMax: boolean, v: string | number, r: string, s: string) {
|
|
272
|
+
const __encodeData = defaultAbiCoder.encode(["address","uint256","uint256","uint256","address","uint256","bool","uint8","bytes32","bytes32"], [token,liquidity,amountTokenMin,amountETHMin,to,deadline,approveMax,v,r,s]);
|
|
273
|
+
return hexlify(concat(['0xded9382a', __encodeData]));
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* encode removeLiquidityETHWithPermitSupportingFeeOnTransferTokens
|
|
278
|
+
* @param {string} token - address
|
|
279
|
+
* @param {string | number} liquidity - uint256
|
|
280
|
+
* @param {string | number} amountTokenMin - uint256
|
|
281
|
+
* @param {string | number} amountETHMin - uint256
|
|
282
|
+
* @param {string} to - address
|
|
283
|
+
* @param {string | number} deadline - uint256
|
|
284
|
+
* @param {boolean} approveMax - bool
|
|
285
|
+
* @param {string | number} v - uint8
|
|
286
|
+
* @param {string} r - bytes32
|
|
287
|
+
* @param {string} s - bytes32
|
|
288
|
+
* @returns {string} encode data
|
|
289
|
+
*/
|
|
290
|
+
export function encodeUniswapV2Router02FixedFeeRemoveLiquidityETHWithPermitSupportingFeeOnTransferTokens(token: string, liquidity: string | number, amountTokenMin: string | number, amountETHMin: string | number, to: string, deadline: string | number, approveMax: boolean, v: string | number, r: string, s: string) {
|
|
291
|
+
const __encodeData = defaultAbiCoder.encode(["address","uint256","uint256","uint256","address","uint256","bool","uint8","bytes32","bytes32"], [token,liquidity,amountTokenMin,amountETHMin,to,deadline,approveMax,v,r,s]);
|
|
292
|
+
return hexlify(concat(['0x5b0d5984', __encodeData]));
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* encode removeLiquidityWithPermit
|
|
297
|
+
* @param {string} tokenA - address
|
|
298
|
+
* @param {string} tokenB - address
|
|
299
|
+
* @param {string | number} liquidity - uint256
|
|
300
|
+
* @param {string | number} amountAMin - uint256
|
|
301
|
+
* @param {string | number} amountBMin - uint256
|
|
302
|
+
* @param {string} to - address
|
|
303
|
+
* @param {string | number} deadline - uint256
|
|
304
|
+
* @param {boolean} approveMax - bool
|
|
305
|
+
* @param {string | number} v - uint8
|
|
306
|
+
* @param {string} r - bytes32
|
|
307
|
+
* @param {string} s - bytes32
|
|
308
|
+
* @returns {string} encode data
|
|
309
|
+
*/
|
|
310
|
+
export function encodeUniswapV2Router02FixedFeeRemoveLiquidityWithPermit(tokenA: string, tokenB: string, liquidity: string | number, amountAMin: string | number, amountBMin: string | number, to: string, deadline: string | number, approveMax: boolean, v: string | number, r: string, s: string) {
|
|
311
|
+
const __encodeData = defaultAbiCoder.encode(["address","address","uint256","uint256","uint256","address","uint256","bool","uint8","bytes32","bytes32"], [tokenA,tokenB,liquidity,amountAMin,amountBMin,to,deadline,approveMax,v,r,s]);
|
|
312
|
+
return hexlify(concat(['0x2195995c', __encodeData]));
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* encode swapETHForExactTokens
|
|
317
|
+
* @param {string | number} amountOut - uint256
|
|
318
|
+
* @param {Array<string>} path - address[]
|
|
319
|
+
* @param {string} to - address
|
|
320
|
+
* @param {string | number} deadline - uint256
|
|
321
|
+
* @returns {string} encode data
|
|
322
|
+
*/
|
|
323
|
+
export function encodeUniswapV2Router02FixedFeeSwapETHForExactTokens(amountOut: string | number, path: Array<string>, to: string, deadline: string | number) {
|
|
324
|
+
const __encodeData = defaultAbiCoder.encode(["uint256","address[]","address","uint256"], [amountOut,path,to,deadline]);
|
|
325
|
+
return hexlify(concat(['0xfb3bdb41', __encodeData]));
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* encode swapExactETHForTokens
|
|
330
|
+
* @param {string | number} amountOutMin - uint256
|
|
331
|
+
* @param {Array<string>} path - address[]
|
|
332
|
+
* @param {string} to - address
|
|
333
|
+
* @param {string | number} deadline - uint256
|
|
334
|
+
* @returns {string} encode data
|
|
335
|
+
*/
|
|
336
|
+
export function encodeUniswapV2Router02FixedFeeSwapExactETHForTokens(amountOutMin: string | number, path: Array<string>, to: string, deadline: string | number) {
|
|
337
|
+
const __encodeData = defaultAbiCoder.encode(["uint256","address[]","address","uint256"], [amountOutMin,path,to,deadline]);
|
|
338
|
+
return hexlify(concat(['0x7ff36ab5', __encodeData]));
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* encode swapExactETHForTokensSupportingFeeOnTransferTokens
|
|
343
|
+
* @param {string | number} amountOutMin - uint256
|
|
344
|
+
* @param {Array<string>} path - address[]
|
|
345
|
+
* @param {string} to - address
|
|
346
|
+
* @param {string | number} deadline - uint256
|
|
347
|
+
* @returns {string} encode data
|
|
348
|
+
*/
|
|
349
|
+
export function encodeUniswapV2Router02FixedFeeSwapExactETHForTokensSupportingFeeOnTransferTokens(amountOutMin: string | number, path: Array<string>, to: string, deadline: string | number) {
|
|
350
|
+
const __encodeData = defaultAbiCoder.encode(["uint256","address[]","address","uint256"], [amountOutMin,path,to,deadline]);
|
|
351
|
+
return hexlify(concat(['0xb6f9de95', __encodeData]));
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* encode swapExactTokensForETH
|
|
356
|
+
* @param {string | number} amountIn - uint256
|
|
357
|
+
* @param {string | number} amountOutMin - uint256
|
|
358
|
+
* @param {Array<string>} path - address[]
|
|
359
|
+
* @param {string} to - address
|
|
360
|
+
* @param {string | number} deadline - uint256
|
|
361
|
+
* @returns {string} encode data
|
|
362
|
+
*/
|
|
363
|
+
export function encodeUniswapV2Router02FixedFeeSwapExactTokensForETH(amountIn: string | number, amountOutMin: string | number, path: Array<string>, to: string, deadline: string | number) {
|
|
364
|
+
const __encodeData = defaultAbiCoder.encode(["uint256","uint256","address[]","address","uint256"], [amountIn,amountOutMin,path,to,deadline]);
|
|
365
|
+
return hexlify(concat(['0x18cbafe5', __encodeData]));
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* encode swapExactTokensForETHSupportingFeeOnTransferTokens
|
|
370
|
+
* @param {string | number} amountIn - uint256
|
|
371
|
+
* @param {string | number} amountOutMin - uint256
|
|
372
|
+
* @param {Array<string>} path - address[]
|
|
373
|
+
* @param {string} to - address
|
|
374
|
+
* @param {string | number} deadline - uint256
|
|
375
|
+
* @returns {string} encode data
|
|
376
|
+
*/
|
|
377
|
+
export function encodeUniswapV2Router02FixedFeeSwapExactTokensForETHSupportingFeeOnTransferTokens(amountIn: string | number, amountOutMin: string | number, path: Array<string>, to: string, deadline: string | number) {
|
|
378
|
+
const __encodeData = defaultAbiCoder.encode(["uint256","uint256","address[]","address","uint256"], [amountIn,amountOutMin,path,to,deadline]);
|
|
379
|
+
return hexlify(concat(['0x791ac947', __encodeData]));
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* encode swapExactTokensForTokens
|
|
384
|
+
* @param {string | number} amountIn - uint256
|
|
385
|
+
* @param {string | number} amountOutMin - uint256
|
|
386
|
+
* @param {Array<string>} path - address[]
|
|
387
|
+
* @param {string} to - address
|
|
388
|
+
* @param {string | number} deadline - uint256
|
|
389
|
+
* @returns {string} encode data
|
|
390
|
+
*/
|
|
391
|
+
export function encodeUniswapV2Router02FixedFeeSwapExactTokensForTokens(amountIn: string | number, amountOutMin: string | number, path: Array<string>, to: string, deadline: string | number) {
|
|
392
|
+
const __encodeData = defaultAbiCoder.encode(["uint256","uint256","address[]","address","uint256"], [amountIn,amountOutMin,path,to,deadline]);
|
|
393
|
+
return hexlify(concat(['0x38ed1739', __encodeData]));
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* encode swapExactTokensForTokensSupportingFeeOnTransferTokens
|
|
398
|
+
* @param {string | number} amountIn - uint256
|
|
399
|
+
* @param {string | number} amountOutMin - uint256
|
|
400
|
+
* @param {Array<string>} path - address[]
|
|
401
|
+
* @param {string} to - address
|
|
402
|
+
* @param {string | number} deadline - uint256
|
|
403
|
+
* @returns {string} encode data
|
|
404
|
+
*/
|
|
405
|
+
export function encodeUniswapV2Router02FixedFeeSwapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn: string | number, amountOutMin: string | number, path: Array<string>, to: string, deadline: string | number) {
|
|
406
|
+
const __encodeData = defaultAbiCoder.encode(["uint256","uint256","address[]","address","uint256"], [amountIn,amountOutMin,path,to,deadline]);
|
|
407
|
+
return hexlify(concat(['0x5c11d795', __encodeData]));
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* encode swapTokensForExactETH
|
|
412
|
+
* @param {string | number} amountOut - uint256
|
|
413
|
+
* @param {string | number} amountInMax - uint256
|
|
414
|
+
* @param {Array<string>} path - address[]
|
|
415
|
+
* @param {string} to - address
|
|
416
|
+
* @param {string | number} deadline - uint256
|
|
417
|
+
* @returns {string} encode data
|
|
418
|
+
*/
|
|
419
|
+
export function encodeUniswapV2Router02FixedFeeSwapTokensForExactETH(amountOut: string | number, amountInMax: string | number, path: Array<string>, to: string, deadline: string | number) {
|
|
420
|
+
const __encodeData = defaultAbiCoder.encode(["uint256","uint256","address[]","address","uint256"], [amountOut,amountInMax,path,to,deadline]);
|
|
421
|
+
return hexlify(concat(['0x4a25d94a', __encodeData]));
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* encode swapTokensForExactTokens
|
|
426
|
+
* @param {string | number} amountOut - uint256
|
|
427
|
+
* @param {string | number} amountInMax - uint256
|
|
428
|
+
* @param {Array<string>} path - address[]
|
|
429
|
+
* @param {string} to - address
|
|
430
|
+
* @param {string | number} deadline - uint256
|
|
431
|
+
* @returns {string} encode data
|
|
432
|
+
*/
|
|
433
|
+
export function encodeUniswapV2Router02FixedFeeSwapTokensForExactTokens(amountOut: string | number, amountInMax: string | number, path: Array<string>, to: string, deadline: string | number) {
|
|
434
|
+
const __encodeData = defaultAbiCoder.encode(["uint256","uint256","address[]","address","uint256"], [amountOut,amountInMax,path,to,deadline]);
|
|
435
|
+
return hexlify(concat(['0x8803dbee', __encodeData]));
|
|
436
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -60,7 +60,9 @@ export * from './contract/LimitOrderBot';
|
|
|
60
60
|
export * from './contract/MulticallWithValid';
|
|
61
61
|
export * from './contract/PermissionManager';
|
|
62
62
|
export * from './contract/UniswapV2Factory';
|
|
63
|
+
export * from './contract/UniswapV2FactoryFixedFee';
|
|
63
64
|
export * from './contract/UniswapV2Pair';
|
|
64
65
|
export * from './contract/UniswapV2Router02';
|
|
66
|
+
export * from './contract/UniswapV2Router02FixedFee';
|
|
65
67
|
export * from './contract/dodoTeam';
|
|
66
68
|
export * from './contract/vDODOToken';
|