@dodoex/dodo-contract-request 1.2.0 → 1.3.0
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/UniswapV2Pair.json +1 -0
- package/CHANGELOG.md +7 -0
- package/contract-config/sepolia.json +2 -2
- package/dist/index.js +1 -1
- package/dist/types/contract/UniswapV2Pair.d.ts +225 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/contract/UniswapV2Pair.ts +377 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fetch DOMAIN_SEPARATOR
|
|
3
|
+
* @param {number} chainId - number
|
|
4
|
+
* @param {string} __to - string
|
|
5
|
+
* @returns {string} __output0 - bytes32
|
|
6
|
+
*/
|
|
7
|
+
export declare function fetchUniswapV2PairDOMAIN_SEPARATOR(chainId: number, __to: string): any;
|
|
8
|
+
/**
|
|
9
|
+
* fetch MINIMUM_LIQUIDITY
|
|
10
|
+
* @param {number} chainId - number
|
|
11
|
+
* @param {string} __to - string
|
|
12
|
+
* @returns {bigint} __output0 - uint256
|
|
13
|
+
*/
|
|
14
|
+
export declare function fetchUniswapV2PairMINIMUM_LIQUIDITY(chainId: number, __to: string): any;
|
|
15
|
+
/**
|
|
16
|
+
* fetch PERMIT_TYPEHASH
|
|
17
|
+
* @param {number} chainId - number
|
|
18
|
+
* @param {string} __to - string
|
|
19
|
+
* @returns {string} __output0 - bytes32
|
|
20
|
+
*/
|
|
21
|
+
export declare function fetchUniswapV2PairPERMIT_TYPEHASH(chainId: number, __to: string): any;
|
|
22
|
+
/**
|
|
23
|
+
* fetch allowance
|
|
24
|
+
* @param {number} chainId - number
|
|
25
|
+
* @param {string} __to - string
|
|
26
|
+
* @param {string} __input1 - address
|
|
27
|
+
* @param {string} __input2 - address
|
|
28
|
+
* @returns {bigint} __output0 - uint256
|
|
29
|
+
*/
|
|
30
|
+
export declare function fetchUniswapV2PairAllowance(chainId: number, __to: string, __input1: string, __input2: string): any;
|
|
31
|
+
/**
|
|
32
|
+
* fetch balanceOf
|
|
33
|
+
* @param {number} chainId - number
|
|
34
|
+
* @param {string} __to - string
|
|
35
|
+
* @param {string} __input1 - address
|
|
36
|
+
* @returns {bigint} __output0 - uint256
|
|
37
|
+
*/
|
|
38
|
+
export declare function fetchUniswapV2PairBalanceOf(chainId: number, __to: string, __input1: string): any;
|
|
39
|
+
/**
|
|
40
|
+
* fetch decimals
|
|
41
|
+
* @param {number} chainId - number
|
|
42
|
+
* @param {string} __to - string
|
|
43
|
+
* @returns {bigint} __output0 - uint8
|
|
44
|
+
*/
|
|
45
|
+
export declare function fetchUniswapV2PairDecimals(chainId: number, __to: string): any;
|
|
46
|
+
/**
|
|
47
|
+
* fetch factory
|
|
48
|
+
* @param {number} chainId - number
|
|
49
|
+
* @param {string} __to - string
|
|
50
|
+
* @returns {string} __output0 - address
|
|
51
|
+
*/
|
|
52
|
+
export declare function fetchUniswapV2PairFactory(chainId: number, __to: string): any;
|
|
53
|
+
/**
|
|
54
|
+
* fetch feeRate
|
|
55
|
+
* @param {number} chainId - number
|
|
56
|
+
* @param {string} __to - string
|
|
57
|
+
* @returns {bigint} __output0 - uint256
|
|
58
|
+
*/
|
|
59
|
+
export declare function fetchUniswapV2PairFeeRate(chainId: number, __to: string): any;
|
|
60
|
+
/**
|
|
61
|
+
* fetch getReserves
|
|
62
|
+
* @param {number} chainId - number
|
|
63
|
+
* @param {string} __to - string
|
|
64
|
+
* @returns {bigint} _reserve0 - uint112
|
|
65
|
+
* @returns {bigint} _reserve1 - uint112
|
|
66
|
+
* @returns {bigint} _blockTimestampLast - uint32
|
|
67
|
+
*/
|
|
68
|
+
export declare function fetchUniswapV2PairGetReserves(chainId: number, __to: string): any;
|
|
69
|
+
/**
|
|
70
|
+
* fetch kLast
|
|
71
|
+
* @param {number} chainId - number
|
|
72
|
+
* @param {string} __to - string
|
|
73
|
+
* @returns {bigint} __output0 - uint256
|
|
74
|
+
*/
|
|
75
|
+
export declare function fetchUniswapV2PairKLast(chainId: number, __to: string): any;
|
|
76
|
+
/**
|
|
77
|
+
* fetch lpMtRatio
|
|
78
|
+
* @param {number} chainId - number
|
|
79
|
+
* @param {string} __to - string
|
|
80
|
+
* @returns {bigint} __output0 - uint256
|
|
81
|
+
*/
|
|
82
|
+
export declare function fetchUniswapV2PairLpMtRatio(chainId: number, __to: string): any;
|
|
83
|
+
/**
|
|
84
|
+
* fetch name
|
|
85
|
+
* @param {number} chainId - number
|
|
86
|
+
* @param {string} __to - string
|
|
87
|
+
* @returns {string} __output0 - string
|
|
88
|
+
*/
|
|
89
|
+
export declare function fetchUniswapV2PairName(chainId: number, __to: string): any;
|
|
90
|
+
/**
|
|
91
|
+
* fetch nonces
|
|
92
|
+
* @param {number} chainId - number
|
|
93
|
+
* @param {string} __to - string
|
|
94
|
+
* @param {string} __input1 - address
|
|
95
|
+
* @returns {bigint} __output0 - uint256
|
|
96
|
+
*/
|
|
97
|
+
export declare function fetchUniswapV2PairNonces(chainId: number, __to: string, __input1: string): any;
|
|
98
|
+
/**
|
|
99
|
+
* fetch price0CumulativeLast
|
|
100
|
+
* @param {number} chainId - number
|
|
101
|
+
* @param {string} __to - string
|
|
102
|
+
* @returns {bigint} __output0 - uint256
|
|
103
|
+
*/
|
|
104
|
+
export declare function fetchUniswapV2PairPrice0CumulativeLast(chainId: number, __to: string): any;
|
|
105
|
+
/**
|
|
106
|
+
* fetch price1CumulativeLast
|
|
107
|
+
* @param {number} chainId - number
|
|
108
|
+
* @param {string} __to - string
|
|
109
|
+
* @returns {bigint} __output0 - uint256
|
|
110
|
+
*/
|
|
111
|
+
export declare function fetchUniswapV2PairPrice1CumulativeLast(chainId: number, __to: string): any;
|
|
112
|
+
/**
|
|
113
|
+
* fetch symbol
|
|
114
|
+
* @param {number} chainId - number
|
|
115
|
+
* @param {string} __to - string
|
|
116
|
+
* @returns {string} __output0 - string
|
|
117
|
+
*/
|
|
118
|
+
export declare function fetchUniswapV2PairSymbol(chainId: number, __to: string): any;
|
|
119
|
+
/**
|
|
120
|
+
* fetch token0
|
|
121
|
+
* @param {number} chainId - number
|
|
122
|
+
* @param {string} __to - string
|
|
123
|
+
* @returns {string} __output0 - address
|
|
124
|
+
*/
|
|
125
|
+
export declare function fetchUniswapV2PairToken0(chainId: number, __to: string): any;
|
|
126
|
+
/**
|
|
127
|
+
* fetch token1
|
|
128
|
+
* @param {number} chainId - number
|
|
129
|
+
* @param {string} __to - string
|
|
130
|
+
* @returns {string} __output0 - address
|
|
131
|
+
*/
|
|
132
|
+
export declare function fetchUniswapV2PairToken1(chainId: number, __to: string): any;
|
|
133
|
+
/**
|
|
134
|
+
* fetch totalSupply
|
|
135
|
+
* @param {number} chainId - number
|
|
136
|
+
* @param {string} __to - string
|
|
137
|
+
* @returns {bigint} __output0 - uint256
|
|
138
|
+
*/
|
|
139
|
+
export declare function fetchUniswapV2PairTotalSupply(chainId: number, __to: string): any;
|
|
140
|
+
/**
|
|
141
|
+
* encode approve
|
|
142
|
+
* @param {string} spender - address
|
|
143
|
+
* @param {string} value - uint256
|
|
144
|
+
* @returns {string} encode data
|
|
145
|
+
*/
|
|
146
|
+
export declare function encodeUniswapV2PairApprove(spender: string, value: string): any;
|
|
147
|
+
/**
|
|
148
|
+
* encode burn
|
|
149
|
+
* @param {string} to - address
|
|
150
|
+
* @returns {string} encode data
|
|
151
|
+
*/
|
|
152
|
+
export declare function encodeUniswapV2PairBurn(to: string): any;
|
|
153
|
+
/**
|
|
154
|
+
* encode initialize
|
|
155
|
+
* @param {string} _token0 - address
|
|
156
|
+
* @param {string} _token1 - address
|
|
157
|
+
* @returns {string} encode data
|
|
158
|
+
*/
|
|
159
|
+
export declare function encodeUniswapV2PairInitialize(_token0: string, _token1: string): any;
|
|
160
|
+
/**
|
|
161
|
+
* encode mint
|
|
162
|
+
* @param {string} to - address
|
|
163
|
+
* @returns {string} encode data
|
|
164
|
+
*/
|
|
165
|
+
export declare function encodeUniswapV2PairMint(to: string): any;
|
|
166
|
+
/**
|
|
167
|
+
* encode permit
|
|
168
|
+
* @param {string} owner - address
|
|
169
|
+
* @param {string} spender - address
|
|
170
|
+
* @param {string} value - uint256
|
|
171
|
+
* @param {string} deadline - uint256
|
|
172
|
+
* @param {string} v - uint8
|
|
173
|
+
* @param {string} r - bytes32
|
|
174
|
+
* @param {string} s - bytes32
|
|
175
|
+
* @returns {string} encode data
|
|
176
|
+
*/
|
|
177
|
+
export declare function encodeUniswapV2PairPermit(owner: string, spender: string, value: string, deadline: string, v: string, r: string, s: string): any;
|
|
178
|
+
/**
|
|
179
|
+
* encode setFeeRate
|
|
180
|
+
* @param {string} totalFeeRate - uint256
|
|
181
|
+
* @returns {string} encode data
|
|
182
|
+
*/
|
|
183
|
+
export declare function encodeUniswapV2PairSetFeeRate(totalFeeRate: string): any;
|
|
184
|
+
/**
|
|
185
|
+
* encode setLpMtRatio
|
|
186
|
+
* @param {string} ratio - uint256
|
|
187
|
+
* @returns {string} encode data
|
|
188
|
+
*/
|
|
189
|
+
export declare function encodeUniswapV2PairSetLpMtRatio(ratio: string): any;
|
|
190
|
+
/**
|
|
191
|
+
* encode skim
|
|
192
|
+
* @param {string} to - address
|
|
193
|
+
* @returns {string} encode data
|
|
194
|
+
*/
|
|
195
|
+
export declare function encodeUniswapV2PairSkim(to: string): any;
|
|
196
|
+
/**
|
|
197
|
+
* encode swap
|
|
198
|
+
* @param {string} amount0Out - uint256
|
|
199
|
+
* @param {string} amount1Out - uint256
|
|
200
|
+
* @param {string} to - address
|
|
201
|
+
* @param {string} data - bytes
|
|
202
|
+
* @returns {string} encode data
|
|
203
|
+
*/
|
|
204
|
+
export declare function encodeUniswapV2PairSwap(amount0Out: string, amount1Out: string, to: string, data: string): any;
|
|
205
|
+
/**
|
|
206
|
+
* encode sync
|
|
207
|
+
|
|
208
|
+
* @returns {string} encode data
|
|
209
|
+
*/
|
|
210
|
+
export declare function encodeUniswapV2PairSync(): any;
|
|
211
|
+
/**
|
|
212
|
+
* encode transfer
|
|
213
|
+
* @param {string} to - address
|
|
214
|
+
* @param {string} value - uint256
|
|
215
|
+
* @returns {string} encode data
|
|
216
|
+
*/
|
|
217
|
+
export declare function encodeUniswapV2PairTransfer(to: string, value: string): any;
|
|
218
|
+
/**
|
|
219
|
+
* encode transferFrom
|
|
220
|
+
* @param {string} from - address
|
|
221
|
+
* @param {string} to - address
|
|
222
|
+
* @param {string} value - uint256
|
|
223
|
+
* @returns {string} encode data
|
|
224
|
+
*/
|
|
225
|
+
export declare function encodeUniswapV2PairTransferFrom(from: string, to: string, value: string): any;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export * from './contract/LimitOrderBot';
|
|
|
58
58
|
export * from './contract/MulticallWithValid';
|
|
59
59
|
export * from './contract/PermissionManager';
|
|
60
60
|
export * from './contract/UniswapV2Factory';
|
|
61
|
+
export * from './contract/UniswapV2Pair';
|
|
61
62
|
export * from './contract/UniswapV2Router02';
|
|
62
63
|
export * from './contract/dodoTeam';
|
|
63
64
|
export * from './contract/vDODOToken';
|
package/package.json
CHANGED
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { defaultAbiCoder, concat, hexlify } from '@dodoex/contract-request';
|
|
2
|
+
|
|
3
|
+
import { contractRequests } from '../contractRequests';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* fetch DOMAIN_SEPARATOR
|
|
9
|
+
* @param {number} chainId - number
|
|
10
|
+
* @param {string} __to - string
|
|
11
|
+
* @returns {string} __output0 - bytes32
|
|
12
|
+
*/
|
|
13
|
+
export function fetchUniswapV2PairDOMAIN_SEPARATOR(chainId: number, __to: string) {
|
|
14
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
15
|
+
const __data = hexlify(concat(['0x3644e515', __encodeData]));
|
|
16
|
+
return contractRequests.batchCall<string>(chainId, __to, __data, ["bytes32"])
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* fetch MINIMUM_LIQUIDITY
|
|
21
|
+
* @param {number} chainId - number
|
|
22
|
+
* @param {string} __to - string
|
|
23
|
+
* @returns {bigint} __output0 - uint256
|
|
24
|
+
*/
|
|
25
|
+
export function fetchUniswapV2PairMINIMUM_LIQUIDITY(chainId: number, __to: string) {
|
|
26
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
27
|
+
const __data = hexlify(concat(['0xba9a7a56', __encodeData]));
|
|
28
|
+
return contractRequests.batchCall<bigint>(chainId, __to, __data, ["uint256"])
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* fetch PERMIT_TYPEHASH
|
|
33
|
+
* @param {number} chainId - number
|
|
34
|
+
* @param {string} __to - string
|
|
35
|
+
* @returns {string} __output0 - bytes32
|
|
36
|
+
*/
|
|
37
|
+
export function fetchUniswapV2PairPERMIT_TYPEHASH(chainId: number, __to: string) {
|
|
38
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
39
|
+
const __data = hexlify(concat(['0x30adf81f', __encodeData]));
|
|
40
|
+
return contractRequests.batchCall<string>(chainId, __to, __data, ["bytes32"])
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* fetch allowance
|
|
45
|
+
* @param {number} chainId - number
|
|
46
|
+
* @param {string} __to - string
|
|
47
|
+
* @param {string} __input1 - address
|
|
48
|
+
* @param {string} __input2 - address
|
|
49
|
+
* @returns {bigint} __output0 - uint256
|
|
50
|
+
*/
|
|
51
|
+
export function fetchUniswapV2PairAllowance(chainId: number, __to: string, __input1: string, __input2: string) {
|
|
52
|
+
const __encodeData = defaultAbiCoder.encode(["address","address"], [__input1,__input2]);
|
|
53
|
+
const __data = hexlify(concat(['0xdd62ed3e', __encodeData]));
|
|
54
|
+
return contractRequests.batchCall<bigint>(chainId, __to, __data, ["uint256"])
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* fetch balanceOf
|
|
59
|
+
* @param {number} chainId - number
|
|
60
|
+
* @param {string} __to - string
|
|
61
|
+
* @param {string} __input1 - address
|
|
62
|
+
* @returns {bigint} __output0 - uint256
|
|
63
|
+
*/
|
|
64
|
+
export function fetchUniswapV2PairBalanceOf(chainId: number, __to: string, __input1: string) {
|
|
65
|
+
const __encodeData = defaultAbiCoder.encode(["address"], [__input1]);
|
|
66
|
+
const __data = hexlify(concat(['0x70a08231', __encodeData]));
|
|
67
|
+
return contractRequests.batchCall<bigint>(chainId, __to, __data, ["uint256"])
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* fetch decimals
|
|
72
|
+
* @param {number} chainId - number
|
|
73
|
+
* @param {string} __to - string
|
|
74
|
+
* @returns {bigint} __output0 - uint8
|
|
75
|
+
*/
|
|
76
|
+
export function fetchUniswapV2PairDecimals(chainId: number, __to: string) {
|
|
77
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
78
|
+
const __data = hexlify(concat(['0x313ce567', __encodeData]));
|
|
79
|
+
return contractRequests.batchCall<bigint>(chainId, __to, __data, ["uint8"])
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* fetch factory
|
|
84
|
+
* @param {number} chainId - number
|
|
85
|
+
* @param {string} __to - string
|
|
86
|
+
* @returns {string} __output0 - address
|
|
87
|
+
*/
|
|
88
|
+
export function fetchUniswapV2PairFactory(chainId: number, __to: string) {
|
|
89
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
90
|
+
const __data = hexlify(concat(['0xc45a0155', __encodeData]));
|
|
91
|
+
return contractRequests.batchCall<string>(chainId, __to, __data, ["address"])
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* fetch feeRate
|
|
96
|
+
* @param {number} chainId - number
|
|
97
|
+
* @param {string} __to - string
|
|
98
|
+
* @returns {bigint} __output0 - uint256
|
|
99
|
+
*/
|
|
100
|
+
export function fetchUniswapV2PairFeeRate(chainId: number, __to: string) {
|
|
101
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
102
|
+
const __data = hexlify(concat(['0x978bbdb9', __encodeData]));
|
|
103
|
+
return contractRequests.batchCall<bigint>(chainId, __to, __data, ["uint256"])
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* fetch getReserves
|
|
108
|
+
* @param {number} chainId - number
|
|
109
|
+
* @param {string} __to - string
|
|
110
|
+
* @returns {bigint} _reserve0 - uint112
|
|
111
|
+
* @returns {bigint} _reserve1 - uint112
|
|
112
|
+
* @returns {bigint} _blockTimestampLast - uint32
|
|
113
|
+
*/
|
|
114
|
+
export function fetchUniswapV2PairGetReserves(chainId: number, __to: string) {
|
|
115
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
116
|
+
const __data = hexlify(concat(['0x0902f1ac', __encodeData]));
|
|
117
|
+
return contractRequests.batchCall<{
|
|
118
|
+
_reserve0: bigint;
|
|
119
|
+
_reserve1: bigint;
|
|
120
|
+
_blockTimestampLast: bigint;
|
|
121
|
+
}>(chainId, __to, __data, ["uint112","uint112","uint32"])
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* fetch kLast
|
|
126
|
+
* @param {number} chainId - number
|
|
127
|
+
* @param {string} __to - string
|
|
128
|
+
* @returns {bigint} __output0 - uint256
|
|
129
|
+
*/
|
|
130
|
+
export function fetchUniswapV2PairKLast(chainId: number, __to: string) {
|
|
131
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
132
|
+
const __data = hexlify(concat(['0x7464fc3d', __encodeData]));
|
|
133
|
+
return contractRequests.batchCall<bigint>(chainId, __to, __data, ["uint256"])
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* fetch lpMtRatio
|
|
138
|
+
* @param {number} chainId - number
|
|
139
|
+
* @param {string} __to - string
|
|
140
|
+
* @returns {bigint} __output0 - uint256
|
|
141
|
+
*/
|
|
142
|
+
export function fetchUniswapV2PairLpMtRatio(chainId: number, __to: string) {
|
|
143
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
144
|
+
const __data = hexlify(concat(['0x9670a8cb', __encodeData]));
|
|
145
|
+
return contractRequests.batchCall<bigint>(chainId, __to, __data, ["uint256"])
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* fetch name
|
|
150
|
+
* @param {number} chainId - number
|
|
151
|
+
* @param {string} __to - string
|
|
152
|
+
* @returns {string} __output0 - string
|
|
153
|
+
*/
|
|
154
|
+
export function fetchUniswapV2PairName(chainId: number, __to: string) {
|
|
155
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
156
|
+
const __data = hexlify(concat(['0x06fdde03', __encodeData]));
|
|
157
|
+
return contractRequests.batchCall<string>(chainId, __to, __data, ["string"])
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* fetch nonces
|
|
162
|
+
* @param {number} chainId - number
|
|
163
|
+
* @param {string} __to - string
|
|
164
|
+
* @param {string} __input1 - address
|
|
165
|
+
* @returns {bigint} __output0 - uint256
|
|
166
|
+
*/
|
|
167
|
+
export function fetchUniswapV2PairNonces(chainId: number, __to: string, __input1: string) {
|
|
168
|
+
const __encodeData = defaultAbiCoder.encode(["address"], [__input1]);
|
|
169
|
+
const __data = hexlify(concat(['0x7ecebe00', __encodeData]));
|
|
170
|
+
return contractRequests.batchCall<bigint>(chainId, __to, __data, ["uint256"])
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* fetch price0CumulativeLast
|
|
175
|
+
* @param {number} chainId - number
|
|
176
|
+
* @param {string} __to - string
|
|
177
|
+
* @returns {bigint} __output0 - uint256
|
|
178
|
+
*/
|
|
179
|
+
export function fetchUniswapV2PairPrice0CumulativeLast(chainId: number, __to: string) {
|
|
180
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
181
|
+
const __data = hexlify(concat(['0x5909c0d5', __encodeData]));
|
|
182
|
+
return contractRequests.batchCall<bigint>(chainId, __to, __data, ["uint256"])
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* fetch price1CumulativeLast
|
|
187
|
+
* @param {number} chainId - number
|
|
188
|
+
* @param {string} __to - string
|
|
189
|
+
* @returns {bigint} __output0 - uint256
|
|
190
|
+
*/
|
|
191
|
+
export function fetchUniswapV2PairPrice1CumulativeLast(chainId: number, __to: string) {
|
|
192
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
193
|
+
const __data = hexlify(concat(['0x5a3d5493', __encodeData]));
|
|
194
|
+
return contractRequests.batchCall<bigint>(chainId, __to, __data, ["uint256"])
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* fetch symbol
|
|
199
|
+
* @param {number} chainId - number
|
|
200
|
+
* @param {string} __to - string
|
|
201
|
+
* @returns {string} __output0 - string
|
|
202
|
+
*/
|
|
203
|
+
export function fetchUniswapV2PairSymbol(chainId: number, __to: string) {
|
|
204
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
205
|
+
const __data = hexlify(concat(['0x95d89b41', __encodeData]));
|
|
206
|
+
return contractRequests.batchCall<string>(chainId, __to, __data, ["string"])
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* fetch token0
|
|
211
|
+
* @param {number} chainId - number
|
|
212
|
+
* @param {string} __to - string
|
|
213
|
+
* @returns {string} __output0 - address
|
|
214
|
+
*/
|
|
215
|
+
export function fetchUniswapV2PairToken0(chainId: number, __to: string) {
|
|
216
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
217
|
+
const __data = hexlify(concat(['0x0dfe1681', __encodeData]));
|
|
218
|
+
return contractRequests.batchCall<string>(chainId, __to, __data, ["address"])
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* fetch token1
|
|
223
|
+
* @param {number} chainId - number
|
|
224
|
+
* @param {string} __to - string
|
|
225
|
+
* @returns {string} __output0 - address
|
|
226
|
+
*/
|
|
227
|
+
export function fetchUniswapV2PairToken1(chainId: number, __to: string) {
|
|
228
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
229
|
+
const __data = hexlify(concat(['0xd21220a7', __encodeData]));
|
|
230
|
+
return contractRequests.batchCall<string>(chainId, __to, __data, ["address"])
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* fetch totalSupply
|
|
235
|
+
* @param {number} chainId - number
|
|
236
|
+
* @param {string} __to - string
|
|
237
|
+
* @returns {bigint} __output0 - uint256
|
|
238
|
+
*/
|
|
239
|
+
export function fetchUniswapV2PairTotalSupply(chainId: number, __to: string) {
|
|
240
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
241
|
+
const __data = hexlify(concat(['0x18160ddd', __encodeData]));
|
|
242
|
+
return contractRequests.batchCall<bigint>(chainId, __to, __data, ["uint256"])
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* encode approve
|
|
247
|
+
* @param {string} spender - address
|
|
248
|
+
* @param {string} value - uint256
|
|
249
|
+
* @returns {string} encode data
|
|
250
|
+
*/
|
|
251
|
+
export function encodeUniswapV2PairApprove(spender: string, value: string) {
|
|
252
|
+
const __encodeData = defaultAbiCoder.encode(["address","uint256"], [spender,value]);
|
|
253
|
+
return hexlify(concat(['0x095ea7b3', __encodeData]));
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* encode burn
|
|
258
|
+
* @param {string} to - address
|
|
259
|
+
* @returns {string} encode data
|
|
260
|
+
*/
|
|
261
|
+
export function encodeUniswapV2PairBurn(to: string) {
|
|
262
|
+
const __encodeData = defaultAbiCoder.encode(["address"], [to]);
|
|
263
|
+
return hexlify(concat(['0x89afcb44', __encodeData]));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* encode initialize
|
|
268
|
+
* @param {string} _token0 - address
|
|
269
|
+
* @param {string} _token1 - address
|
|
270
|
+
* @returns {string} encode data
|
|
271
|
+
*/
|
|
272
|
+
export function encodeUniswapV2PairInitialize(_token0: string, _token1: string) {
|
|
273
|
+
const __encodeData = defaultAbiCoder.encode(["address","address"], [_token0,_token1]);
|
|
274
|
+
return hexlify(concat(['0x485cc955', __encodeData]));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* encode mint
|
|
279
|
+
* @param {string} to - address
|
|
280
|
+
* @returns {string} encode data
|
|
281
|
+
*/
|
|
282
|
+
export function encodeUniswapV2PairMint(to: string) {
|
|
283
|
+
const __encodeData = defaultAbiCoder.encode(["address"], [to]);
|
|
284
|
+
return hexlify(concat(['0x6a627842', __encodeData]));
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* encode permit
|
|
289
|
+
* @param {string} owner - address
|
|
290
|
+
* @param {string} spender - address
|
|
291
|
+
* @param {string} value - uint256
|
|
292
|
+
* @param {string} deadline - uint256
|
|
293
|
+
* @param {string} v - uint8
|
|
294
|
+
* @param {string} r - bytes32
|
|
295
|
+
* @param {string} s - bytes32
|
|
296
|
+
* @returns {string} encode data
|
|
297
|
+
*/
|
|
298
|
+
export function encodeUniswapV2PairPermit(owner: string, spender: string, value: string, deadline: string, v: string, r: string, s: string) {
|
|
299
|
+
const __encodeData = defaultAbiCoder.encode(["address","address","uint256","uint256","uint8","bytes32","bytes32"], [owner,spender,value,deadline,v,r,s]);
|
|
300
|
+
return hexlify(concat(['0xd505accf', __encodeData]));
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* encode setFeeRate
|
|
305
|
+
* @param {string} totalFeeRate - uint256
|
|
306
|
+
* @returns {string} encode data
|
|
307
|
+
*/
|
|
308
|
+
export function encodeUniswapV2PairSetFeeRate(totalFeeRate: string) {
|
|
309
|
+
const __encodeData = defaultAbiCoder.encode(["uint256"], [totalFeeRate]);
|
|
310
|
+
return hexlify(concat(['0x45596e2e', __encodeData]));
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* encode setLpMtRatio
|
|
315
|
+
* @param {string} ratio - uint256
|
|
316
|
+
* @returns {string} encode data
|
|
317
|
+
*/
|
|
318
|
+
export function encodeUniswapV2PairSetLpMtRatio(ratio: string) {
|
|
319
|
+
const __encodeData = defaultAbiCoder.encode(["uint256"], [ratio]);
|
|
320
|
+
return hexlify(concat(['0xa1e281de', __encodeData]));
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* encode skim
|
|
325
|
+
* @param {string} to - address
|
|
326
|
+
* @returns {string} encode data
|
|
327
|
+
*/
|
|
328
|
+
export function encodeUniswapV2PairSkim(to: string) {
|
|
329
|
+
const __encodeData = defaultAbiCoder.encode(["address"], [to]);
|
|
330
|
+
return hexlify(concat(['0xbc25cf77', __encodeData]));
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* encode swap
|
|
335
|
+
* @param {string} amount0Out - uint256
|
|
336
|
+
* @param {string} amount1Out - uint256
|
|
337
|
+
* @param {string} to - address
|
|
338
|
+
* @param {string} data - bytes
|
|
339
|
+
* @returns {string} encode data
|
|
340
|
+
*/
|
|
341
|
+
export function encodeUniswapV2PairSwap(amount0Out: string, amount1Out: string, to: string, data: string) {
|
|
342
|
+
const __encodeData = defaultAbiCoder.encode(["uint256","uint256","address","bytes"], [amount0Out,amount1Out,to,data]);
|
|
343
|
+
return hexlify(concat(['0x022c0d9f', __encodeData]));
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* encode sync
|
|
348
|
+
|
|
349
|
+
* @returns {string} encode data
|
|
350
|
+
*/
|
|
351
|
+
export function encodeUniswapV2PairSync() {
|
|
352
|
+
const __encodeData = defaultAbiCoder.encode([], []);
|
|
353
|
+
return hexlify(concat(['0xfff6cae9', __encodeData]));
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* encode transfer
|
|
358
|
+
* @param {string} to - address
|
|
359
|
+
* @param {string} value - uint256
|
|
360
|
+
* @returns {string} encode data
|
|
361
|
+
*/
|
|
362
|
+
export function encodeUniswapV2PairTransfer(to: string, value: string) {
|
|
363
|
+
const __encodeData = defaultAbiCoder.encode(["address","uint256"], [to,value]);
|
|
364
|
+
return hexlify(concat(['0xa9059cbb', __encodeData]));
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* encode transferFrom
|
|
369
|
+
* @param {string} from - address
|
|
370
|
+
* @param {string} to - address
|
|
371
|
+
* @param {string} value - uint256
|
|
372
|
+
* @returns {string} encode data
|
|
373
|
+
*/
|
|
374
|
+
export function encodeUniswapV2PairTransferFrom(from: string, to: string, value: string) {
|
|
375
|
+
const __encodeData = defaultAbiCoder.encode(["address","address","uint256"], [from,to,value]);
|
|
376
|
+
return hexlify(concat(['0x23b872dd', __encodeData]));
|
|
377
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -59,6 +59,7 @@ export * from './contract/LimitOrderBot';
|
|
|
59
59
|
export * from './contract/MulticallWithValid';
|
|
60
60
|
export * from './contract/PermissionManager';
|
|
61
61
|
export * from './contract/UniswapV2Factory';
|
|
62
|
+
export * from './contract/UniswapV2Pair';
|
|
62
63
|
export * from './contract/UniswapV2Router02';
|
|
63
64
|
export * from './contract/dodoTeam';
|
|
64
65
|
export * from './contract/vDODOToken';
|