@luxfi/exchange 0.1.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/dist/bridge/__tests__/use-private-teleport.test.d.ts +2 -0
- package/dist/bridge/__tests__/use-private-teleport.test.d.ts.map +1 -0
- package/dist/bridge/__tests__/use-private-teleport.test.js +272 -0
- package/dist/bridge/cross-chain-store.d.ts +57 -0
- package/dist/bridge/cross-chain-store.d.ts.map +1 -0
- package/dist/bridge/cross-chain-store.js +158 -0
- package/dist/bridge/index.d.ts +78 -0
- package/dist/bridge/index.d.ts.map +1 -0
- package/dist/bridge/index.js +79 -0
- package/dist/bridge/private-teleport-types.d.ts +634 -0
- package/dist/bridge/private-teleport-types.d.ts.map +1 -0
- package/dist/bridge/private-teleport-types.js +308 -0
- package/dist/bridge/types.d.ts +84 -0
- package/dist/bridge/types.d.ts.map +1 -0
- package/dist/bridge/types.js +37 -0
- package/dist/bridge/use-cross-chain-mint.d.ts +34 -0
- package/dist/bridge/use-cross-chain-mint.d.ts.map +1 -0
- package/dist/bridge/use-cross-chain-mint.js +228 -0
- package/dist/bridge/use-private-teleport.d.ts +69 -0
- package/dist/bridge/use-private-teleport.d.ts.map +1 -0
- package/dist/bridge/use-private-teleport.js +666 -0
- package/dist/chains/index.d.ts +6 -0
- package/dist/chains/index.d.ts.map +1 -0
- package/dist/chains/index.js +6 -0
- package/dist/chains/lux.d.ts +508 -0
- package/dist/chains/lux.d.ts.map +1 -0
- package/dist/chains/lux.js +131 -0
- package/dist/contracts/abis/dex-swap-router.d.ts +137 -0
- package/dist/contracts/abis/dex-swap-router.d.ts.map +1 -0
- package/dist/contracts/abis/dex-swap-router.js +95 -0
- package/dist/contracts/abis/erc20.d.ts +136 -0
- package/dist/contracts/abis/erc20.d.ts.map +1 -0
- package/dist/contracts/abis/erc20.js +96 -0
- package/dist/contracts/abis/index.d.ts +15 -0
- package/dist/contracts/abis/index.d.ts.map +1 -0
- package/dist/contracts/abis/index.js +15 -0
- package/dist/contracts/abis/nft-position-manager.d.ts +235 -0
- package/dist/contracts/abis/nft-position-manager.d.ts.map +1 -0
- package/dist/contracts/abis/nft-position-manager.js +146 -0
- package/dist/contracts/abis/pool-manager.d.ts +315 -0
- package/dist/contracts/abis/pool-manager.d.ts.map +1 -0
- package/dist/contracts/abis/pool-manager.js +191 -0
- package/dist/contracts/abis/quoter-v2.d.ts +103 -0
- package/dist/contracts/abis/quoter-v2.d.ts.map +1 -0
- package/dist/contracts/abis/quoter-v2.js +68 -0
- package/dist/contracts/abis/swap-router.d.ts +119 -0
- package/dist/contracts/abis/swap-router.d.ts.map +1 -0
- package/dist/contracts/abis/swap-router.js +75 -0
- package/dist/contracts/abis/uniswap-v2-factory.d.ts +75 -0
- package/dist/contracts/abis/uniswap-v2-factory.d.ts.map +1 -0
- package/dist/contracts/abis/uniswap-v2-factory.js +49 -0
- package/dist/contracts/abis/uniswap-v2-pair.d.ts +119 -0
- package/dist/contracts/abis/uniswap-v2-pair.d.ts.map +1 -0
- package/dist/contracts/abis/uniswap-v2-pair.js +85 -0
- package/dist/contracts/abis/uniswap-v2-router.d.ts +249 -0
- package/dist/contracts/abis/uniswap-v2-router.d.ts.map +1 -0
- package/dist/contracts/abis/uniswap-v2-router.js +146 -0
- package/dist/contracts/abis/uniswap-v3-factory.d.ts +77 -0
- package/dist/contracts/abis/uniswap-v3-factory.d.ts.map +1 -0
- package/dist/contracts/abis/uniswap-v3-factory.js +45 -0
- package/dist/contracts/abis/uniswap-v3-pool.d.ts +128 -0
- package/dist/contracts/abis/uniswap-v3-pool.d.ts.map +1 -0
- package/dist/contracts/abis/uniswap-v3-pool.js +81 -0
- package/dist/contracts/addresses.d.ts +141 -0
- package/dist/contracts/addresses.d.ts.map +1 -0
- package/dist/contracts/addresses.js +108 -0
- package/dist/contracts/index.d.ts +6 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +5 -0
- package/dist/dex/balance-delta.d.ts +27 -0
- package/dist/dex/balance-delta.d.ts.map +1 -0
- package/dist/dex/balance-delta.js +45 -0
- package/dist/dex/index.d.ts +7 -0
- package/dist/dex/index.d.ts.map +1 -0
- package/dist/dex/index.js +6 -0
- package/dist/dex/pool-key.d.ts +19 -0
- package/dist/dex/pool-key.d.ts.map +1 -0
- package/dist/dex/pool-key.js +44 -0
- package/dist/dex/types.d.ts +71 -0
- package/dist/dex/types.d.ts.map +1 -0
- package/dist/dex/types.js +28 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +9 -0
- package/dist/hooks/use-pools.d.ts +24 -0
- package/dist/hooks/use-pools.d.ts.map +1 -0
- package/dist/hooks/use-pools.js +85 -0
- package/dist/hooks/use-positions.d.ts +17 -0
- package/dist/hooks/use-positions.d.ts.map +1 -0
- package/dist/hooks/use-positions.js +65 -0
- package/dist/hooks/use-swap-quote.d.ts +19 -0
- package/dist/hooks/use-swap-quote.d.ts.map +1 -0
- package/dist/hooks/use-swap-quote.js +54 -0
- package/dist/hooks/use-swap.d.ts +22 -0
- package/dist/hooks/use-swap.d.ts.map +1 -0
- package/dist/hooks/use-swap.js +46 -0
- package/dist/hooks/use-token-allowance.d.ts +27 -0
- package/dist/hooks/use-token-allowance.d.ts.map +1 -0
- package/dist/hooks/use-token-allowance.js +59 -0
- package/dist/hooks/use-token-balance.d.ts +17 -0
- package/dist/hooks/use-token-balance.d.ts.map +1 -0
- package/dist/hooks/use-token-balance.js +58 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/stores/index.d.ts +7 -0
- package/dist/stores/index.d.ts.map +1 -0
- package/dist/stores/index.js +6 -0
- package/dist/stores/settings-store.d.ts +25 -0
- package/dist/stores/settings-store.d.ts.map +1 -0
- package/dist/stores/settings-store.js +16 -0
- package/dist/stores/swap-store.d.ts +38 -0
- package/dist/stores/swap-store.d.ts.map +1 -0
- package/dist/stores/swap-store.js +58 -0
- package/dist/stores/token-store.d.ts +21 -0
- package/dist/stores/token-store.d.ts.map +1 -0
- package/dist/stores/token-store.js +32 -0
- package/dist/tokens/index.d.ts +65 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/index.js +185 -0
- package/package.json +78 -0
- package/src/chains/index.ts +21 -0
- package/src/chains/lux.ts +141 -0
- package/src/contracts/abis/dex-swap-router.ts +98 -0
- package/src/contracts/abis/erc20.ts +96 -0
- package/src/contracts/abis/index.ts +17 -0
- package/src/contracts/abis/nft-position-manager.ts +146 -0
- package/src/contracts/abis/pool-manager.ts +198 -0
- package/src/contracts/abis/quoter-v2.ts +68 -0
- package/src/contracts/abis/swap-router.ts +75 -0
- package/src/contracts/abis/uniswap-v2-factory.ts +49 -0
- package/src/contracts/abis/uniswap-v2-pair.ts +85 -0
- package/src/contracts/abis/uniswap-v2-router.ts +146 -0
- package/src/contracts/abis/uniswap-v3-factory.ts +45 -0
- package/src/contracts/abis/uniswap-v3-pool.ts +81 -0
- package/src/contracts/addresses.ts +128 -0
- package/src/contracts/index.ts +14 -0
- package/src/dex/balance-delta.ts +52 -0
- package/src/dex/index.ts +7 -0
- package/src/dex/pool-key.ts +62 -0
- package/src/dex/types.ts +87 -0
- package/src/hooks/index.ts +10 -0
- package/src/hooks/use-pools.ts +116 -0
- package/src/hooks/use-positions.ts +90 -0
- package/src/hooks/use-swap-quote.ts +81 -0
- package/src/hooks/use-swap.ts +64 -0
- package/src/hooks/use-token-allowance.ts +74 -0
- package/src/hooks/use-token-balance.ts +71 -0
- package/src/index.ts +31 -0
- package/src/stores/index.ts +7 -0
- package/src/stores/settings-store.ts +54 -0
- package/src/stores/swap-store.ts +112 -0
- package/src/stores/token-store.ts +62 -0
- package/src/tokens/index.ts +220 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PoolManager Precompile ABI (0x0400)
|
|
3
|
+
* Native Uniswap v4-style AMM implementation
|
|
4
|
+
*/
|
|
5
|
+
export const POOL_MANAGER_ABI = [
|
|
6
|
+
// Pool initialization
|
|
7
|
+
{
|
|
8
|
+
type: 'function',
|
|
9
|
+
name: 'initialize',
|
|
10
|
+
inputs: [
|
|
11
|
+
{
|
|
12
|
+
name: 'key',
|
|
13
|
+
type: 'tuple',
|
|
14
|
+
components: [
|
|
15
|
+
{ name: 'currency0', type: 'address' },
|
|
16
|
+
{ name: 'currency1', type: 'address' },
|
|
17
|
+
{ name: 'fee', type: 'uint24' },
|
|
18
|
+
{ name: 'tickSpacing', type: 'int24' },
|
|
19
|
+
{ name: 'hooks', type: 'address' },
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
{ name: 'sqrtPriceX96', type: 'uint160' },
|
|
23
|
+
{ name: 'hookData', type: 'bytes' },
|
|
24
|
+
],
|
|
25
|
+
outputs: [{ name: 'tick', type: 'int24' }],
|
|
26
|
+
stateMutability: 'nonpayable',
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
// Flash accounting lock
|
|
30
|
+
{
|
|
31
|
+
type: 'function',
|
|
32
|
+
name: 'lock',
|
|
33
|
+
inputs: [{ name: 'data', type: 'bytes' }],
|
|
34
|
+
outputs: [{ name: 'result', type: 'bytes' }],
|
|
35
|
+
stateMutability: 'nonpayable',
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
// Swap
|
|
39
|
+
{
|
|
40
|
+
type: 'function',
|
|
41
|
+
name: 'swap',
|
|
42
|
+
inputs: [
|
|
43
|
+
{
|
|
44
|
+
name: 'key',
|
|
45
|
+
type: 'tuple',
|
|
46
|
+
components: [
|
|
47
|
+
{ name: 'currency0', type: 'address' },
|
|
48
|
+
{ name: 'currency1', type: 'address' },
|
|
49
|
+
{ name: 'fee', type: 'uint24' },
|
|
50
|
+
{ name: 'tickSpacing', type: 'int24' },
|
|
51
|
+
{ name: 'hooks', type: 'address' },
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'params',
|
|
56
|
+
type: 'tuple',
|
|
57
|
+
components: [
|
|
58
|
+
{ name: 'zeroForOne', type: 'bool' },
|
|
59
|
+
{ name: 'amountSpecified', type: 'int256' },
|
|
60
|
+
{ name: 'sqrtPriceLimitX96', type: 'uint160' },
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
{ name: 'hookData', type: 'bytes' },
|
|
64
|
+
],
|
|
65
|
+
outputs: [{ name: 'delta', type: 'int256' }],
|
|
66
|
+
stateMutability: 'nonpayable',
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
// Modify liquidity
|
|
70
|
+
{
|
|
71
|
+
type: 'function',
|
|
72
|
+
name: 'modifyLiquidity',
|
|
73
|
+
inputs: [
|
|
74
|
+
{
|
|
75
|
+
name: 'key',
|
|
76
|
+
type: 'tuple',
|
|
77
|
+
components: [
|
|
78
|
+
{ name: 'currency0', type: 'address' },
|
|
79
|
+
{ name: 'currency1', type: 'address' },
|
|
80
|
+
{ name: 'fee', type: 'uint24' },
|
|
81
|
+
{ name: 'tickSpacing', type: 'int24' },
|
|
82
|
+
{ name: 'hooks', type: 'address' },
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'params',
|
|
87
|
+
type: 'tuple',
|
|
88
|
+
components: [
|
|
89
|
+
{ name: 'tickLower', type: 'int24' },
|
|
90
|
+
{ name: 'tickUpper', type: 'int24' },
|
|
91
|
+
{ name: 'liquidityDelta', type: 'int256' },
|
|
92
|
+
{ name: 'salt', type: 'bytes32' },
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
{ name: 'hookData', type: 'bytes' },
|
|
96
|
+
],
|
|
97
|
+
outputs: [
|
|
98
|
+
{ name: 'delta', type: 'int256' },
|
|
99
|
+
{ name: 'feeDelta', type: 'int256' },
|
|
100
|
+
],
|
|
101
|
+
stateMutability: 'nonpayable',
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
// Donate
|
|
105
|
+
{
|
|
106
|
+
type: 'function',
|
|
107
|
+
name: 'donate',
|
|
108
|
+
inputs: [
|
|
109
|
+
{
|
|
110
|
+
name: 'key',
|
|
111
|
+
type: 'tuple',
|
|
112
|
+
components: [
|
|
113
|
+
{ name: 'currency0', type: 'address' },
|
|
114
|
+
{ name: 'currency1', type: 'address' },
|
|
115
|
+
{ name: 'fee', type: 'uint24' },
|
|
116
|
+
{ name: 'tickSpacing', type: 'int24' },
|
|
117
|
+
{ name: 'hooks', type: 'address' },
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
{ name: 'amount0', type: 'uint256' },
|
|
121
|
+
{ name: 'amount1', type: 'uint256' },
|
|
122
|
+
{ name: 'hookData', type: 'bytes' },
|
|
123
|
+
],
|
|
124
|
+
outputs: [{ name: 'delta', type: 'int256' }],
|
|
125
|
+
stateMutability: 'nonpayable',
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
// Settle and take for flash accounting
|
|
129
|
+
{
|
|
130
|
+
type: 'function',
|
|
131
|
+
name: 'settle',
|
|
132
|
+
inputs: [{ name: 'currency', type: 'address' }],
|
|
133
|
+
outputs: [{ name: 'paid', type: 'uint256' }],
|
|
134
|
+
stateMutability: 'payable',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
type: 'function',
|
|
138
|
+
name: 'take',
|
|
139
|
+
inputs: [
|
|
140
|
+
{ name: 'currency', type: 'address' },
|
|
141
|
+
{ name: 'to', type: 'address' },
|
|
142
|
+
{ name: 'amount', type: 'uint256' },
|
|
143
|
+
],
|
|
144
|
+
outputs: [],
|
|
145
|
+
stateMutability: 'nonpayable',
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
// Pool state queries
|
|
149
|
+
{
|
|
150
|
+
type: 'function',
|
|
151
|
+
name: 'getSlot0',
|
|
152
|
+
inputs: [{ name: 'poolId', type: 'bytes32' }],
|
|
153
|
+
outputs: [
|
|
154
|
+
{ name: 'sqrtPriceX96', type: 'uint160' },
|
|
155
|
+
{ name: 'tick', type: 'int24' },
|
|
156
|
+
{ name: 'protocolFee', type: 'uint24' },
|
|
157
|
+
{ name: 'lpFee', type: 'uint24' },
|
|
158
|
+
],
|
|
159
|
+
stateMutability: 'view',
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
type: 'function',
|
|
163
|
+
name: 'getLiquidity',
|
|
164
|
+
inputs: [{ name: 'poolId', type: 'bytes32' }],
|
|
165
|
+
outputs: [{ name: 'liquidity', type: 'uint128' }],
|
|
166
|
+
stateMutability: 'view',
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
// Events
|
|
170
|
+
{
|
|
171
|
+
type: 'event',
|
|
172
|
+
name: 'Initialize',
|
|
173
|
+
inputs: [
|
|
174
|
+
{ name: 'id', type: 'bytes32', indexed: true },
|
|
175
|
+
{ name: 'currency0', type: 'address', indexed: true },
|
|
176
|
+
{ name: 'currency1', type: 'address', indexed: true },
|
|
177
|
+
{ name: 'fee', type: 'uint24', indexed: false },
|
|
178
|
+
{ name: 'tickSpacing', type: 'int24', indexed: false },
|
|
179
|
+
{ name: 'hooks', type: 'address', indexed: false },
|
|
180
|
+
{ name: 'sqrtPriceX96', type: 'uint160', indexed: false },
|
|
181
|
+
{ name: 'tick', type: 'int24', indexed: false },
|
|
182
|
+
],
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
type: 'event',
|
|
186
|
+
name: 'Swap',
|
|
187
|
+
inputs: [
|
|
188
|
+
{ name: 'id', type: 'bytes32', indexed: true },
|
|
189
|
+
{ name: 'sender', type: 'address', indexed: true },
|
|
190
|
+
{ name: 'amount0', type: 'int128', indexed: false },
|
|
191
|
+
{ name: 'amount1', type: 'int128', indexed: false },
|
|
192
|
+
{ name: 'sqrtPriceX96', type: 'uint160', indexed: false },
|
|
193
|
+
{ name: 'liquidity', type: 'uint128', indexed: false },
|
|
194
|
+
{ name: 'tick', type: 'int24', indexed: false },
|
|
195
|
+
{ name: 'fee', type: 'uint24', indexed: false },
|
|
196
|
+
],
|
|
197
|
+
},
|
|
198
|
+
] as const
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QuoterV2 ABI
|
|
3
|
+
*/
|
|
4
|
+
export const QUOTER_V2_ABI = [
|
|
5
|
+
{
|
|
6
|
+
type: 'function',
|
|
7
|
+
name: 'quoteExactInputSingle',
|
|
8
|
+
inputs: [
|
|
9
|
+
{
|
|
10
|
+
name: 'params',
|
|
11
|
+
type: 'tuple',
|
|
12
|
+
components: [
|
|
13
|
+
{ name: 'tokenIn', type: 'address' },
|
|
14
|
+
{ name: 'tokenOut', type: 'address' },
|
|
15
|
+
{ name: 'amountIn', type: 'uint256' },
|
|
16
|
+
{ name: 'fee', type: 'uint24' },
|
|
17
|
+
{ name: 'sqrtPriceLimitX96', type: 'uint160' },
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
outputs: [
|
|
22
|
+
{ name: 'amountOut', type: 'uint256' },
|
|
23
|
+
{ name: 'sqrtPriceX96After', type: 'uint160' },
|
|
24
|
+
{ name: 'initializedTicksCrossed', type: 'uint32' },
|
|
25
|
+
{ name: 'gasEstimate', type: 'uint256' },
|
|
26
|
+
],
|
|
27
|
+
stateMutability: 'nonpayable',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: 'function',
|
|
31
|
+
name: 'quoteExactOutputSingle',
|
|
32
|
+
inputs: [
|
|
33
|
+
{
|
|
34
|
+
name: 'params',
|
|
35
|
+
type: 'tuple',
|
|
36
|
+
components: [
|
|
37
|
+
{ name: 'tokenIn', type: 'address' },
|
|
38
|
+
{ name: 'tokenOut', type: 'address' },
|
|
39
|
+
{ name: 'amount', type: 'uint256' },
|
|
40
|
+
{ name: 'fee', type: 'uint24' },
|
|
41
|
+
{ name: 'sqrtPriceLimitX96', type: 'uint160' },
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
outputs: [
|
|
46
|
+
{ name: 'amountIn', type: 'uint256' },
|
|
47
|
+
{ name: 'sqrtPriceX96After', type: 'uint160' },
|
|
48
|
+
{ name: 'initializedTicksCrossed', type: 'uint32' },
|
|
49
|
+
{ name: 'gasEstimate', type: 'uint256' },
|
|
50
|
+
],
|
|
51
|
+
stateMutability: 'nonpayable',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: 'function',
|
|
55
|
+
name: 'quoteExactInput',
|
|
56
|
+
inputs: [
|
|
57
|
+
{ name: 'path', type: 'bytes' },
|
|
58
|
+
{ name: 'amountIn', type: 'uint256' },
|
|
59
|
+
],
|
|
60
|
+
outputs: [
|
|
61
|
+
{ name: 'amountOut', type: 'uint256' },
|
|
62
|
+
{ name: 'sqrtPriceX96AfterList', type: 'uint160[]' },
|
|
63
|
+
{ name: 'initializedTicksCrossedList', type: 'uint32[]' },
|
|
64
|
+
{ name: 'gasEstimate', type: 'uint256' },
|
|
65
|
+
],
|
|
66
|
+
stateMutability: 'nonpayable',
|
|
67
|
+
},
|
|
68
|
+
] as const
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SwapRouter ABI (V3)
|
|
3
|
+
*/
|
|
4
|
+
export const SWAP_ROUTER_ABI = [
|
|
5
|
+
{
|
|
6
|
+
type: 'function',
|
|
7
|
+
name: 'exactInputSingle',
|
|
8
|
+
inputs: [
|
|
9
|
+
{
|
|
10
|
+
name: 'params',
|
|
11
|
+
type: 'tuple',
|
|
12
|
+
components: [
|
|
13
|
+
{ name: 'tokenIn', type: 'address' },
|
|
14
|
+
{ name: 'tokenOut', type: 'address' },
|
|
15
|
+
{ name: 'fee', type: 'uint24' },
|
|
16
|
+
{ name: 'recipient', type: 'address' },
|
|
17
|
+
{ name: 'deadline', type: 'uint256' },
|
|
18
|
+
{ name: 'amountIn', type: 'uint256' },
|
|
19
|
+
{ name: 'amountOutMinimum', type: 'uint256' },
|
|
20
|
+
{ name: 'sqrtPriceLimitX96', type: 'uint160' },
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
outputs: [{ name: 'amountOut', type: 'uint256' }],
|
|
25
|
+
stateMutability: 'payable',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
type: 'function',
|
|
29
|
+
name: 'exactOutputSingle',
|
|
30
|
+
inputs: [
|
|
31
|
+
{
|
|
32
|
+
name: 'params',
|
|
33
|
+
type: 'tuple',
|
|
34
|
+
components: [
|
|
35
|
+
{ name: 'tokenIn', type: 'address' },
|
|
36
|
+
{ name: 'tokenOut', type: 'address' },
|
|
37
|
+
{ name: 'fee', type: 'uint24' },
|
|
38
|
+
{ name: 'recipient', type: 'address' },
|
|
39
|
+
{ name: 'deadline', type: 'uint256' },
|
|
40
|
+
{ name: 'amountOut', type: 'uint256' },
|
|
41
|
+
{ name: 'amountInMaximum', type: 'uint256' },
|
|
42
|
+
{ name: 'sqrtPriceLimitX96', type: 'uint160' },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
outputs: [{ name: 'amountIn', type: 'uint256' }],
|
|
47
|
+
stateMutability: 'payable',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
type: 'function',
|
|
51
|
+
name: 'exactInput',
|
|
52
|
+
inputs: [
|
|
53
|
+
{
|
|
54
|
+
name: 'params',
|
|
55
|
+
type: 'tuple',
|
|
56
|
+
components: [
|
|
57
|
+
{ name: 'path', type: 'bytes' },
|
|
58
|
+
{ name: 'recipient', type: 'address' },
|
|
59
|
+
{ name: 'deadline', type: 'uint256' },
|
|
60
|
+
{ name: 'amountIn', type: 'uint256' },
|
|
61
|
+
{ name: 'amountOutMinimum', type: 'uint256' },
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
outputs: [{ name: 'amountOut', type: 'uint256' }],
|
|
66
|
+
stateMutability: 'payable',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: 'function',
|
|
70
|
+
name: 'multicall',
|
|
71
|
+
inputs: [{ name: 'data', type: 'bytes[]' }],
|
|
72
|
+
outputs: [{ name: 'results', type: 'bytes[]' }],
|
|
73
|
+
stateMutability: 'payable',
|
|
74
|
+
},
|
|
75
|
+
] as const
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UniswapV2Factory ABI
|
|
3
|
+
*/
|
|
4
|
+
export const UNISWAP_V2_FACTORY_ABI = [
|
|
5
|
+
{
|
|
6
|
+
type: 'function',
|
|
7
|
+
name: 'getPair',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'tokenA', type: 'address' },
|
|
10
|
+
{ name: 'tokenB', type: 'address' },
|
|
11
|
+
],
|
|
12
|
+
outputs: [{ name: 'pair', type: 'address' }],
|
|
13
|
+
stateMutability: 'view',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
type: 'function',
|
|
17
|
+
name: 'allPairs',
|
|
18
|
+
inputs: [{ name: 'index', type: 'uint256' }],
|
|
19
|
+
outputs: [{ name: 'pair', type: 'address' }],
|
|
20
|
+
stateMutability: 'view',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
type: 'function',
|
|
24
|
+
name: 'allPairsLength',
|
|
25
|
+
inputs: [],
|
|
26
|
+
outputs: [{ type: 'uint256' }],
|
|
27
|
+
stateMutability: 'view',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: 'function',
|
|
31
|
+
name: 'createPair',
|
|
32
|
+
inputs: [
|
|
33
|
+
{ name: 'tokenA', type: 'address' },
|
|
34
|
+
{ name: 'tokenB', type: 'address' },
|
|
35
|
+
],
|
|
36
|
+
outputs: [{ name: 'pair', type: 'address' }],
|
|
37
|
+
stateMutability: 'nonpayable',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: 'event',
|
|
41
|
+
name: 'PairCreated',
|
|
42
|
+
inputs: [
|
|
43
|
+
{ name: 'token0', type: 'address', indexed: true },
|
|
44
|
+
{ name: 'token1', type: 'address', indexed: true },
|
|
45
|
+
{ name: 'pair', type: 'address', indexed: false },
|
|
46
|
+
{ name: 'index', type: 'uint256', indexed: false },
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
] as const
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UniswapV2Pair ABI
|
|
3
|
+
*/
|
|
4
|
+
export const UNISWAP_V2_PAIR_ABI = [
|
|
5
|
+
{
|
|
6
|
+
type: 'function',
|
|
7
|
+
name: 'token0',
|
|
8
|
+
inputs: [],
|
|
9
|
+
outputs: [{ type: 'address' }],
|
|
10
|
+
stateMutability: 'view',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
type: 'function',
|
|
14
|
+
name: 'token1',
|
|
15
|
+
inputs: [],
|
|
16
|
+
outputs: [{ type: 'address' }],
|
|
17
|
+
stateMutability: 'view',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: 'function',
|
|
21
|
+
name: 'getReserves',
|
|
22
|
+
inputs: [],
|
|
23
|
+
outputs: [
|
|
24
|
+
{ name: 'reserve0', type: 'uint112' },
|
|
25
|
+
{ name: 'reserve1', type: 'uint112' },
|
|
26
|
+
{ name: 'blockTimestampLast', type: 'uint32' },
|
|
27
|
+
],
|
|
28
|
+
stateMutability: 'view',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'function',
|
|
32
|
+
name: 'totalSupply',
|
|
33
|
+
inputs: [],
|
|
34
|
+
outputs: [{ type: 'uint256' }],
|
|
35
|
+
stateMutability: 'view',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: 'function',
|
|
39
|
+
name: 'balanceOf',
|
|
40
|
+
inputs: [{ name: 'owner', type: 'address' }],
|
|
41
|
+
outputs: [{ type: 'uint256' }],
|
|
42
|
+
stateMutability: 'view',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: 'function',
|
|
46
|
+
name: 'price0CumulativeLast',
|
|
47
|
+
inputs: [],
|
|
48
|
+
outputs: [{ type: 'uint256' }],
|
|
49
|
+
stateMutability: 'view',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: 'function',
|
|
53
|
+
name: 'price1CumulativeLast',
|
|
54
|
+
inputs: [],
|
|
55
|
+
outputs: [{ type: 'uint256' }],
|
|
56
|
+
stateMutability: 'view',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: 'function',
|
|
60
|
+
name: 'kLast',
|
|
61
|
+
inputs: [],
|
|
62
|
+
outputs: [{ type: 'uint256' }],
|
|
63
|
+
stateMutability: 'view',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
type: 'event',
|
|
67
|
+
name: 'Swap',
|
|
68
|
+
inputs: [
|
|
69
|
+
{ name: 'sender', type: 'address', indexed: true },
|
|
70
|
+
{ name: 'amount0In', type: 'uint256', indexed: false },
|
|
71
|
+
{ name: 'amount1In', type: 'uint256', indexed: false },
|
|
72
|
+
{ name: 'amount0Out', type: 'uint256', indexed: false },
|
|
73
|
+
{ name: 'amount1Out', type: 'uint256', indexed: false },
|
|
74
|
+
{ name: 'to', type: 'address', indexed: true },
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
type: 'event',
|
|
79
|
+
name: 'Sync',
|
|
80
|
+
inputs: [
|
|
81
|
+
{ name: 'reserve0', type: 'uint112', indexed: false },
|
|
82
|
+
{ name: 'reserve1', type: 'uint112', indexed: false },
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
] as const
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UniswapV2Router02 ABI (used by Lux AMM V2)
|
|
3
|
+
*/
|
|
4
|
+
export const UNISWAP_V2_ROUTER_ABI = [
|
|
5
|
+
{
|
|
6
|
+
type: 'function',
|
|
7
|
+
name: 'factory',
|
|
8
|
+
inputs: [],
|
|
9
|
+
outputs: [{ type: 'address' }],
|
|
10
|
+
stateMutability: 'view',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
type: 'function',
|
|
14
|
+
name: 'WETH',
|
|
15
|
+
inputs: [],
|
|
16
|
+
outputs: [{ type: 'address' }],
|
|
17
|
+
stateMutability: 'view',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: 'function',
|
|
21
|
+
name: 'getAmountsOut',
|
|
22
|
+
inputs: [
|
|
23
|
+
{ name: 'amountIn', type: 'uint256' },
|
|
24
|
+
{ name: 'path', type: 'address[]' },
|
|
25
|
+
],
|
|
26
|
+
outputs: [{ name: 'amounts', type: 'uint256[]' }],
|
|
27
|
+
stateMutability: 'view',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: 'function',
|
|
31
|
+
name: 'getAmountsIn',
|
|
32
|
+
inputs: [
|
|
33
|
+
{ name: 'amountOut', type: 'uint256' },
|
|
34
|
+
{ name: 'path', type: 'address[]' },
|
|
35
|
+
],
|
|
36
|
+
outputs: [{ name: 'amounts', type: 'uint256[]' }],
|
|
37
|
+
stateMutability: 'view',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: 'function',
|
|
41
|
+
name: 'swapExactTokensForTokens',
|
|
42
|
+
inputs: [
|
|
43
|
+
{ name: 'amountIn', type: 'uint256' },
|
|
44
|
+
{ name: 'amountOutMin', type: 'uint256' },
|
|
45
|
+
{ name: 'path', type: 'address[]' },
|
|
46
|
+
{ name: 'to', type: 'address' },
|
|
47
|
+
{ name: 'deadline', type: 'uint256' },
|
|
48
|
+
],
|
|
49
|
+
outputs: [{ name: 'amounts', type: 'uint256[]' }],
|
|
50
|
+
stateMutability: 'nonpayable',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: 'function',
|
|
54
|
+
name: 'swapTokensForExactTokens',
|
|
55
|
+
inputs: [
|
|
56
|
+
{ name: 'amountOut', type: 'uint256' },
|
|
57
|
+
{ name: 'amountInMax', type: 'uint256' },
|
|
58
|
+
{ name: 'path', type: 'address[]' },
|
|
59
|
+
{ name: 'to', type: 'address' },
|
|
60
|
+
{ name: 'deadline', type: 'uint256' },
|
|
61
|
+
],
|
|
62
|
+
outputs: [{ name: 'amounts', type: 'uint256[]' }],
|
|
63
|
+
stateMutability: 'nonpayable',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
type: 'function',
|
|
67
|
+
name: 'swapExactETHForTokens',
|
|
68
|
+
inputs: [
|
|
69
|
+
{ name: 'amountOutMin', type: 'uint256' },
|
|
70
|
+
{ name: 'path', type: 'address[]' },
|
|
71
|
+
{ name: 'to', type: 'address' },
|
|
72
|
+
{ name: 'deadline', type: 'uint256' },
|
|
73
|
+
],
|
|
74
|
+
outputs: [{ name: 'amounts', type: 'uint256[]' }],
|
|
75
|
+
stateMutability: 'payable',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
type: 'function',
|
|
79
|
+
name: 'swapExactTokensForETH',
|
|
80
|
+
inputs: [
|
|
81
|
+
{ name: 'amountIn', type: 'uint256' },
|
|
82
|
+
{ name: 'amountOutMin', type: 'uint256' },
|
|
83
|
+
{ name: 'path', type: 'address[]' },
|
|
84
|
+
{ name: 'to', type: 'address' },
|
|
85
|
+
{ name: 'deadline', type: 'uint256' },
|
|
86
|
+
],
|
|
87
|
+
outputs: [{ name: 'amounts', type: 'uint256[]' }],
|
|
88
|
+
stateMutability: 'nonpayable',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
type: 'function',
|
|
92
|
+
name: 'addLiquidity',
|
|
93
|
+
inputs: [
|
|
94
|
+
{ name: 'tokenA', type: 'address' },
|
|
95
|
+
{ name: 'tokenB', type: 'address' },
|
|
96
|
+
{ name: 'amountADesired', type: 'uint256' },
|
|
97
|
+
{ name: 'amountBDesired', type: 'uint256' },
|
|
98
|
+
{ name: 'amountAMin', type: 'uint256' },
|
|
99
|
+
{ name: 'amountBMin', type: 'uint256' },
|
|
100
|
+
{ name: 'to', type: 'address' },
|
|
101
|
+
{ name: 'deadline', type: 'uint256' },
|
|
102
|
+
],
|
|
103
|
+
outputs: [
|
|
104
|
+
{ name: 'amountA', type: 'uint256' },
|
|
105
|
+
{ name: 'amountB', type: 'uint256' },
|
|
106
|
+
{ name: 'liquidity', type: 'uint256' },
|
|
107
|
+
],
|
|
108
|
+
stateMutability: 'nonpayable',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: 'function',
|
|
112
|
+
name: 'addLiquidityETH',
|
|
113
|
+
inputs: [
|
|
114
|
+
{ name: 'token', type: 'address' },
|
|
115
|
+
{ name: 'amountTokenDesired', type: 'uint256' },
|
|
116
|
+
{ name: 'amountTokenMin', type: 'uint256' },
|
|
117
|
+
{ name: 'amountETHMin', type: 'uint256' },
|
|
118
|
+
{ name: 'to', type: 'address' },
|
|
119
|
+
{ name: 'deadline', type: 'uint256' },
|
|
120
|
+
],
|
|
121
|
+
outputs: [
|
|
122
|
+
{ name: 'amountToken', type: 'uint256' },
|
|
123
|
+
{ name: 'amountETH', type: 'uint256' },
|
|
124
|
+
{ name: 'liquidity', type: 'uint256' },
|
|
125
|
+
],
|
|
126
|
+
stateMutability: 'payable',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
type: 'function',
|
|
130
|
+
name: 'removeLiquidity',
|
|
131
|
+
inputs: [
|
|
132
|
+
{ name: 'tokenA', type: 'address' },
|
|
133
|
+
{ name: 'tokenB', type: 'address' },
|
|
134
|
+
{ name: 'liquidity', type: 'uint256' },
|
|
135
|
+
{ name: 'amountAMin', type: 'uint256' },
|
|
136
|
+
{ name: 'amountBMin', type: 'uint256' },
|
|
137
|
+
{ name: 'to', type: 'address' },
|
|
138
|
+
{ name: 'deadline', type: 'uint256' },
|
|
139
|
+
],
|
|
140
|
+
outputs: [
|
|
141
|
+
{ name: 'amountA', type: 'uint256' },
|
|
142
|
+
{ name: 'amountB', type: 'uint256' },
|
|
143
|
+
],
|
|
144
|
+
stateMutability: 'nonpayable',
|
|
145
|
+
},
|
|
146
|
+
] as const
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UniswapV3Factory ABI
|
|
3
|
+
*/
|
|
4
|
+
export const UNISWAP_V3_FACTORY_ABI = [
|
|
5
|
+
{
|
|
6
|
+
type: 'function',
|
|
7
|
+
name: 'getPool',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'tokenA', type: 'address' },
|
|
10
|
+
{ name: 'tokenB', type: 'address' },
|
|
11
|
+
{ name: 'fee', type: 'uint24' },
|
|
12
|
+
],
|
|
13
|
+
outputs: [{ name: 'pool', type: 'address' }],
|
|
14
|
+
stateMutability: 'view',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: 'function',
|
|
18
|
+
name: 'createPool',
|
|
19
|
+
inputs: [
|
|
20
|
+
{ name: 'tokenA', type: 'address' },
|
|
21
|
+
{ name: 'tokenB', type: 'address' },
|
|
22
|
+
{ name: 'fee', type: 'uint24' },
|
|
23
|
+
],
|
|
24
|
+
outputs: [{ name: 'pool', type: 'address' }],
|
|
25
|
+
stateMutability: 'nonpayable',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
type: 'function',
|
|
29
|
+
name: 'feeAmountTickSpacing',
|
|
30
|
+
inputs: [{ name: 'fee', type: 'uint24' }],
|
|
31
|
+
outputs: [{ name: 'tickSpacing', type: 'int24' }],
|
|
32
|
+
stateMutability: 'view',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: 'event',
|
|
36
|
+
name: 'PoolCreated',
|
|
37
|
+
inputs: [
|
|
38
|
+
{ name: 'token0', type: 'address', indexed: true },
|
|
39
|
+
{ name: 'token1', type: 'address', indexed: true },
|
|
40
|
+
{ name: 'fee', type: 'uint24', indexed: true },
|
|
41
|
+
{ name: 'tickSpacing', type: 'int24', indexed: false },
|
|
42
|
+
{ name: 'pool', type: 'address', indexed: false },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
] as const
|