@paraswap/dex-lib 2.37.2 → 2.37.4-cache-invalidation-fix.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/build/abi/pancakeswap-v3/PancakeswapV3Factory.abi.json +300 -0
- package/build/abi/uniswap-v3/UniswapV3Factory.abi.json +148 -0
- package/build/dex/algebra/algebra-factory.d.ts +25 -0
- package/build/dex/algebra/algebra-factory.js +43 -0
- package/build/dex/algebra/algebra-factory.js.map +1 -0
- package/build/dex/algebra/algebra.d.ts +3 -0
- package/build/dex/algebra/algebra.js +27 -5
- package/build/dex/algebra/algebra.js.map +1 -1
- package/build/dex/algebra/config.js +0 -1
- package/build/dex/algebra/config.js.map +1 -1
- package/build/dex/algebra/types.d.ts +1 -1
- package/build/dex/{woo-fi → hello}/config.d.ts +1 -1
- package/build/dex/{test-dex → hello}/config.js +3 -3
- package/build/dex/hello/config.js.map +1 -0
- package/build/dex/{test-dex/test-dex-pool.d.ts → hello/hello-pool.d.ts} +4 -4
- package/build/dex/{test-dex/test-dex-pool.js → hello/hello-pool.js} +9 -8
- package/build/dex/hello/hello-pool.js.map +1 -0
- package/build/dex/{test-dex/test-dex.d.ts → hello/hello.d.ts} +8 -8
- package/build/dex/{test-dex/test-dex.js → hello/hello.js} +7 -7
- package/build/dex/hello/hello.js.map +1 -0
- package/build/dex/{test-dex → hello}/types.d.ts +1 -1
- package/build/dex/{woo-fi → hello}/types.js.map +1 -1
- package/build/dex/{test-dex → my-test-dex}/config.d.ts +1 -1
- package/build/dex/my-test-dex/config.js +15 -0
- package/build/dex/my-test-dex/config.js.map +1 -0
- package/build/dex/my-test-dex/my-test-dex-pool.d.ts +39 -0
- package/build/dex/my-test-dex/my-test-dex-pool.js +64 -0
- package/build/dex/my-test-dex/my-test-dex-pool.js.map +1 -0
- package/build/dex/my-test-dex/my-test-dex.d.ts +37 -0
- package/build/dex/my-test-dex/my-test-dex.js +126 -0
- package/build/dex/my-test-dex/my-test-dex.js.map +1 -0
- package/build/dex/my-test-dex/types.d.ts +6 -0
- package/build/dex/{test-dex → my-test-dex}/types.js.map +1 -1
- package/build/dex/pancakeswap-v3/pancakeswap-v3-factory.d.ts +26 -0
- package/build/dex/pancakeswap-v3/pancakeswap-v3-factory.js +44 -0
- package/build/dex/pancakeswap-v3/pancakeswap-v3-factory.js.map +1 -0
- package/build/dex/pancakeswap-v3/pancakeswap-v3.d.ts +3 -0
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js +26 -2
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js.map +1 -1
- package/build/dex/uniswap-v3/types.d.ts +1 -0
- package/build/dex/uniswap-v3/types.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3-factory.d.ts +26 -0
- package/build/dex/uniswap-v3/uniswap-v3-factory.js +44 -0
- package/build/dex/uniswap-v3/uniswap-v3-factory.js.map +1 -0
- package/build/dex/uniswap-v3/uniswap-v3.d.ts +3 -0
- package/build/dex/uniswap-v3/uniswap-v3.js +26 -2
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/build/dex-helper/dummy-dex-helper.js +3 -0
- package/build/dex-helper/dummy-dex-helper.js.map +1 -1
- package/build/dex-helper/icache.d.ts +1 -0
- package/package.json +1 -1
- package/src/abi/pancakeswap-v3/PancakeswapV3Factory.abi.json +300 -0
- package/src/dex/algebra/algebra-factory.ts +70 -0
- package/src/dex/algebra/algebra.ts +47 -6
- package/src/dex/algebra/config.ts +0 -1
- package/src/dex/algebra/types.ts +2 -1
- package/src/dex/pancakeswap-v3/pancakeswap-v3-factory.ts +73 -0
- package/src/dex/pancakeswap-v3/pancakeswap-v3.ts +50 -2
- package/src/dex/uniswap-v3/types.ts +2 -0
- package/src/dex/uniswap-v3/uniswap-v3-factory.ts +73 -0
- package/src/dex/uniswap-v3/uniswap-v3.ts +47 -2
- package/src/dex-helper/dummy-dex-helper.ts +4 -0
- package/src/dex-helper/icache.ts +2 -0
- package/build/abi/quickPerps/fast-price-events.json +0 -70
- package/build/abi/quickPerps/fast-price-feed.json +0 -748
- package/build/abi/quickPerps/reader.json +0 -313
- package/build/abi/quickPerps/vault-price-feed.json +0 -477
- package/build/abi/quickPerps/vault.json +0 -1953
- package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +0 -193
- package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3QuoterV2.abi.json +0 -285
- package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3Router.abi.json +0 -583
- package/build/abi/woo-fi/WooFeeManager.abi.json +0 -318
- package/build/abi/woo-fi/WooPP.abi.json +0 -548
- package/build/abi/woo-fi/Wooracle.abi.json +0 -260
- package/build/dex/aave-v3/tokens/arbitrum.json +0 -50
- package/build/dex/aave-v3/tokens/avalanche.json +0 -74
- package/build/dex/aave-v3/tokens/fantom.json +0 -62
- package/build/dex/aave-v3/tokens/optimism.json +0 -50
- package/build/dex/aave-v3/tokens/polygon.json +0 -116
- package/build/dex/balancer-v2/LinearMath.d.ts +0 -19
- package/build/dex/balancer-v2/LinearMath.js +0 -179
- package/build/dex/balancer-v2/LinearMath.js.map +0 -1
- package/build/dex/balancer-v2/LinearPool.d.ts +0 -47
- package/build/dex/balancer-v2/LinearPool.js +0 -324
- package/build/dex/balancer-v2/LinearPool.js.map +0 -1
- package/build/dex/balancer-v2/PhantomStablePool.d.ts +0 -47
- package/build/dex/balancer-v2/PhantomStablePool.js +0 -294
- package/build/dex/balancer-v2/PhantomStablePool.js.map +0 -1
- package/build/dex/balancer-v2/StableMath.d.ts +0 -9
- package/build/dex/balancer-v2/StableMath.js +0 -272
- package/build/dex/balancer-v2/StableMath.js.map +0 -1
- package/build/dex/balancer-v2/balancer-v2-pool.d.ts +0 -75
- package/build/dex/balancer-v2/balancer-v2-pool.js +0 -417
- package/build/dex/balancer-v2/balancer-v2-pool.js.map +0 -1
- package/build/dex/maverick-v1/scripts/event-sequence.d.ts +0 -1
- package/build/dex/maverick-v1/scripts/event-sequence.js +0 -110
- package/build/dex/maverick-v1/scripts/event-sequence.js.map +0 -1
- package/build/dex/quickswap/camelot-v3.d.ts +0 -6
- package/build/dex/quickswap/camelot-v3.js +0 -19
- package/build/dex/quickswap/camelot-v3.js.map +0 -1
- package/build/dex/quickswap/zyberswap-v3.d.ts +0 -6
- package/build/dex/quickswap/zyberswap-v3.js +0 -19
- package/build/dex/quickswap/zyberswap-v3.js.map +0 -1
- package/build/dex/quickswap-v3.d.ts +0 -21
- package/build/dex/quickswap-v3.js +0 -40
- package/build/dex/quickswap-v3.js.map +0 -1
- package/build/dex/test-dex/config.js.map +0 -1
- package/build/dex/test-dex/test-dex-pool.js.map +0 -1
- package/build/dex/test-dex/test-dex.js.map +0 -1
- package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.d.ts +0 -12
- package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js +0 -23
- package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js.map +0 -1
- package/build/dex/woo-fi/config.js +0 -141
- package/build/dex/woo-fi/config.js.map +0 -1
- package/build/dex/woo-fi/constants.d.ts +0 -5
- package/build/dex/woo-fi/constants.js +0 -20
- package/build/dex/woo-fi/constants.js.map +0 -1
- package/build/dex/woo-fi/types.d.ts +0 -48
- package/build/dex/woo-fi/woo-fi-decimal-math.d.ts +0 -14
- package/build/dex/woo-fi/woo-fi-decimal-math.js +0 -42
- package/build/dex/woo-fi/woo-fi-decimal-math.js.map +0 -1
- package/build/dex/woo-fi/woo-fi-math.d.ts +0 -31
- package/build/dex/woo-fi/woo-fi-math.js +0 -300
- package/build/dex/woo-fi/woo-fi-math.js.map +0 -1
- package/build/dex/woo-fi/woo-fi.d.ts +0 -65
- package/build/dex/woo-fi/woo-fi.js +0 -480
- package/build/dex/woo-fi/woo-fi.js.map +0 -1
- package/build/dex/woo-fi-v2/woo-fi-math.d.ts +0 -16
- package/build/dex/woo-fi-v2/woo-fi-math.js +0 -137
- package/build/dex/woo-fi-v2/woo-fi-math.js.map +0 -1
- package/build/workers.d.ts +0 -0
- package/build/workers.js +0 -2
- package/build/workers.js.map +0 -1
- /package/build/dex/{test-dex → hello}/types.js +0 -0
- /package/build/dex/{woo-fi → my-test-dex}/types.js +0 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"inputs": [
|
|
4
|
+
{ "internalType": "address", "name": "_poolDeployer", "type": "address" }
|
|
5
|
+
],
|
|
6
|
+
"stateMutability": "nonpayable",
|
|
7
|
+
"type": "constructor"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"anonymous": false,
|
|
11
|
+
"inputs": [
|
|
12
|
+
{
|
|
13
|
+
"indexed": true,
|
|
14
|
+
"internalType": "uint24",
|
|
15
|
+
"name": "fee",
|
|
16
|
+
"type": "uint24"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"indexed": true,
|
|
20
|
+
"internalType": "int24",
|
|
21
|
+
"name": "tickSpacing",
|
|
22
|
+
"type": "int24"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"name": "FeeAmountEnabled",
|
|
26
|
+
"type": "event"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"anonymous": false,
|
|
30
|
+
"inputs": [
|
|
31
|
+
{
|
|
32
|
+
"indexed": true,
|
|
33
|
+
"internalType": "uint24",
|
|
34
|
+
"name": "fee",
|
|
35
|
+
"type": "uint24"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"indexed": false,
|
|
39
|
+
"internalType": "bool",
|
|
40
|
+
"name": "whitelistRequested",
|
|
41
|
+
"type": "bool"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"indexed": false,
|
|
45
|
+
"internalType": "bool",
|
|
46
|
+
"name": "enabled",
|
|
47
|
+
"type": "bool"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"name": "FeeAmountExtraInfoUpdated",
|
|
51
|
+
"type": "event"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"anonymous": false,
|
|
55
|
+
"inputs": [
|
|
56
|
+
{
|
|
57
|
+
"indexed": true,
|
|
58
|
+
"internalType": "address",
|
|
59
|
+
"name": "oldOwner",
|
|
60
|
+
"type": "address"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"indexed": true,
|
|
64
|
+
"internalType": "address",
|
|
65
|
+
"name": "newOwner",
|
|
66
|
+
"type": "address"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"name": "OwnerChanged",
|
|
70
|
+
"type": "event"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"anonymous": false,
|
|
74
|
+
"inputs": [
|
|
75
|
+
{
|
|
76
|
+
"indexed": true,
|
|
77
|
+
"internalType": "address",
|
|
78
|
+
"name": "token0",
|
|
79
|
+
"type": "address"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"indexed": true,
|
|
83
|
+
"internalType": "address",
|
|
84
|
+
"name": "token1",
|
|
85
|
+
"type": "address"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"indexed": true,
|
|
89
|
+
"internalType": "uint24",
|
|
90
|
+
"name": "fee",
|
|
91
|
+
"type": "uint24"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"indexed": false,
|
|
95
|
+
"internalType": "int24",
|
|
96
|
+
"name": "tickSpacing",
|
|
97
|
+
"type": "int24"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"indexed": false,
|
|
101
|
+
"internalType": "address",
|
|
102
|
+
"name": "pool",
|
|
103
|
+
"type": "address"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"name": "PoolCreated",
|
|
107
|
+
"type": "event"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"anonymous": false,
|
|
111
|
+
"inputs": [
|
|
112
|
+
{
|
|
113
|
+
"indexed": true,
|
|
114
|
+
"internalType": "address",
|
|
115
|
+
"name": "lmPoolDeployer",
|
|
116
|
+
"type": "address"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"name": "SetLmPoolDeployer",
|
|
120
|
+
"type": "event"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"anonymous": false,
|
|
124
|
+
"inputs": [
|
|
125
|
+
{
|
|
126
|
+
"indexed": true,
|
|
127
|
+
"internalType": "address",
|
|
128
|
+
"name": "user",
|
|
129
|
+
"type": "address"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"indexed": false,
|
|
133
|
+
"internalType": "bool",
|
|
134
|
+
"name": "verified",
|
|
135
|
+
"type": "bool"
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
"name": "WhiteListAdded",
|
|
139
|
+
"type": "event"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"inputs": [
|
|
143
|
+
{ "internalType": "address", "name": "pool", "type": "address" },
|
|
144
|
+
{ "internalType": "address", "name": "recipient", "type": "address" },
|
|
145
|
+
{
|
|
146
|
+
"internalType": "uint128",
|
|
147
|
+
"name": "amount0Requested",
|
|
148
|
+
"type": "uint128"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"internalType": "uint128",
|
|
152
|
+
"name": "amount1Requested",
|
|
153
|
+
"type": "uint128"
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
"name": "collectProtocol",
|
|
157
|
+
"outputs": [
|
|
158
|
+
{ "internalType": "uint128", "name": "amount0", "type": "uint128" },
|
|
159
|
+
{ "internalType": "uint128", "name": "amount1", "type": "uint128" }
|
|
160
|
+
],
|
|
161
|
+
"stateMutability": "nonpayable",
|
|
162
|
+
"type": "function"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"inputs": [
|
|
166
|
+
{ "internalType": "address", "name": "tokenA", "type": "address" },
|
|
167
|
+
{ "internalType": "address", "name": "tokenB", "type": "address" },
|
|
168
|
+
{ "internalType": "uint24", "name": "fee", "type": "uint24" }
|
|
169
|
+
],
|
|
170
|
+
"name": "createPool",
|
|
171
|
+
"outputs": [
|
|
172
|
+
{ "internalType": "address", "name": "pool", "type": "address" }
|
|
173
|
+
],
|
|
174
|
+
"stateMutability": "nonpayable",
|
|
175
|
+
"type": "function"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"inputs": [
|
|
179
|
+
{ "internalType": "uint24", "name": "fee", "type": "uint24" },
|
|
180
|
+
{ "internalType": "int24", "name": "tickSpacing", "type": "int24" }
|
|
181
|
+
],
|
|
182
|
+
"name": "enableFeeAmount",
|
|
183
|
+
"outputs": [],
|
|
184
|
+
"stateMutability": "nonpayable",
|
|
185
|
+
"type": "function"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"inputs": [{ "internalType": "uint24", "name": "", "type": "uint24" }],
|
|
189
|
+
"name": "feeAmountTickSpacing",
|
|
190
|
+
"outputs": [{ "internalType": "int24", "name": "", "type": "int24" }],
|
|
191
|
+
"stateMutability": "view",
|
|
192
|
+
"type": "function"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"inputs": [{ "internalType": "uint24", "name": "", "type": "uint24" }],
|
|
196
|
+
"name": "feeAmountTickSpacingExtraInfo",
|
|
197
|
+
"outputs": [
|
|
198
|
+
{ "internalType": "bool", "name": "whitelistRequested", "type": "bool" },
|
|
199
|
+
{ "internalType": "bool", "name": "enabled", "type": "bool" }
|
|
200
|
+
],
|
|
201
|
+
"stateMutability": "view",
|
|
202
|
+
"type": "function"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"inputs": [
|
|
206
|
+
{ "internalType": "address", "name": "", "type": "address" },
|
|
207
|
+
{ "internalType": "address", "name": "", "type": "address" },
|
|
208
|
+
{ "internalType": "uint24", "name": "", "type": "uint24" }
|
|
209
|
+
],
|
|
210
|
+
"name": "getPool",
|
|
211
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
212
|
+
"stateMutability": "view",
|
|
213
|
+
"type": "function"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"inputs": [],
|
|
217
|
+
"name": "lmPoolDeployer",
|
|
218
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
219
|
+
"stateMutability": "view",
|
|
220
|
+
"type": "function"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"inputs": [],
|
|
224
|
+
"name": "owner",
|
|
225
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
226
|
+
"stateMutability": "view",
|
|
227
|
+
"type": "function"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"inputs": [],
|
|
231
|
+
"name": "poolDeployer",
|
|
232
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
233
|
+
"stateMutability": "view",
|
|
234
|
+
"type": "function"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"inputs": [
|
|
238
|
+
{ "internalType": "uint24", "name": "fee", "type": "uint24" },
|
|
239
|
+
{ "internalType": "bool", "name": "whitelistRequested", "type": "bool" },
|
|
240
|
+
{ "internalType": "bool", "name": "enabled", "type": "bool" }
|
|
241
|
+
],
|
|
242
|
+
"name": "setFeeAmountExtraInfo",
|
|
243
|
+
"outputs": [],
|
|
244
|
+
"stateMutability": "nonpayable",
|
|
245
|
+
"type": "function"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"inputs": [
|
|
249
|
+
{ "internalType": "address", "name": "pool", "type": "address" },
|
|
250
|
+
{ "internalType": "uint32", "name": "feeProtocol0", "type": "uint32" },
|
|
251
|
+
{ "internalType": "uint32", "name": "feeProtocol1", "type": "uint32" }
|
|
252
|
+
],
|
|
253
|
+
"name": "setFeeProtocol",
|
|
254
|
+
"outputs": [],
|
|
255
|
+
"stateMutability": "nonpayable",
|
|
256
|
+
"type": "function"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"inputs": [
|
|
260
|
+
{ "internalType": "address", "name": "pool", "type": "address" },
|
|
261
|
+
{ "internalType": "address", "name": "lmPool", "type": "address" }
|
|
262
|
+
],
|
|
263
|
+
"name": "setLmPool",
|
|
264
|
+
"outputs": [],
|
|
265
|
+
"stateMutability": "nonpayable",
|
|
266
|
+
"type": "function"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"inputs": [
|
|
270
|
+
{
|
|
271
|
+
"internalType": "address",
|
|
272
|
+
"name": "_lmPoolDeployer",
|
|
273
|
+
"type": "address"
|
|
274
|
+
}
|
|
275
|
+
],
|
|
276
|
+
"name": "setLmPoolDeployer",
|
|
277
|
+
"outputs": [],
|
|
278
|
+
"stateMutability": "nonpayable",
|
|
279
|
+
"type": "function"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"inputs": [
|
|
283
|
+
{ "internalType": "address", "name": "_owner", "type": "address" }
|
|
284
|
+
],
|
|
285
|
+
"name": "setOwner",
|
|
286
|
+
"outputs": [],
|
|
287
|
+
"stateMutability": "nonpayable",
|
|
288
|
+
"type": "function"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"inputs": [
|
|
292
|
+
{ "internalType": "address", "name": "user", "type": "address" },
|
|
293
|
+
{ "internalType": "bool", "name": "verified", "type": "bool" }
|
|
294
|
+
],
|
|
295
|
+
"name": "setWhiteListAddress",
|
|
296
|
+
"outputs": [],
|
|
297
|
+
"stateMutability": "nonpayable",
|
|
298
|
+
"type": "function"
|
|
299
|
+
}
|
|
300
|
+
]
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
[
|
|
2
|
+
{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" },
|
|
3
|
+
{
|
|
4
|
+
"anonymous": false,
|
|
5
|
+
"inputs": [
|
|
6
|
+
{
|
|
7
|
+
"indexed": true,
|
|
8
|
+
"internalType": "uint24",
|
|
9
|
+
"name": "fee",
|
|
10
|
+
"type": "uint24"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"indexed": true,
|
|
14
|
+
"internalType": "int24",
|
|
15
|
+
"name": "tickSpacing",
|
|
16
|
+
"type": "int24"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"name": "FeeAmountEnabled",
|
|
20
|
+
"type": "event"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"anonymous": false,
|
|
24
|
+
"inputs": [
|
|
25
|
+
{
|
|
26
|
+
"indexed": true,
|
|
27
|
+
"internalType": "address",
|
|
28
|
+
"name": "oldOwner",
|
|
29
|
+
"type": "address"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"indexed": true,
|
|
33
|
+
"internalType": "address",
|
|
34
|
+
"name": "newOwner",
|
|
35
|
+
"type": "address"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"name": "OwnerChanged",
|
|
39
|
+
"type": "event"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"anonymous": false,
|
|
43
|
+
"inputs": [
|
|
44
|
+
{
|
|
45
|
+
"indexed": true,
|
|
46
|
+
"internalType": "address",
|
|
47
|
+
"name": "token0",
|
|
48
|
+
"type": "address"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"indexed": true,
|
|
52
|
+
"internalType": "address",
|
|
53
|
+
"name": "token1",
|
|
54
|
+
"type": "address"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"indexed": true,
|
|
58
|
+
"internalType": "uint24",
|
|
59
|
+
"name": "fee",
|
|
60
|
+
"type": "uint24"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"indexed": false,
|
|
64
|
+
"internalType": "int24",
|
|
65
|
+
"name": "tickSpacing",
|
|
66
|
+
"type": "int24"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"indexed": false,
|
|
70
|
+
"internalType": "address",
|
|
71
|
+
"name": "pool",
|
|
72
|
+
"type": "address"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"name": "PoolCreated",
|
|
76
|
+
"type": "event"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"inputs": [
|
|
80
|
+
{ "internalType": "address", "name": "tokenA", "type": "address" },
|
|
81
|
+
{ "internalType": "address", "name": "tokenB", "type": "address" },
|
|
82
|
+
{ "internalType": "uint24", "name": "fee", "type": "uint24" }
|
|
83
|
+
],
|
|
84
|
+
"name": "createPool",
|
|
85
|
+
"outputs": [
|
|
86
|
+
{ "internalType": "address", "name": "pool", "type": "address" }
|
|
87
|
+
],
|
|
88
|
+
"stateMutability": "nonpayable",
|
|
89
|
+
"type": "function"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"inputs": [
|
|
93
|
+
{ "internalType": "uint24", "name": "fee", "type": "uint24" },
|
|
94
|
+
{ "internalType": "int24", "name": "tickSpacing", "type": "int24" }
|
|
95
|
+
],
|
|
96
|
+
"name": "enableFeeAmount",
|
|
97
|
+
"outputs": [],
|
|
98
|
+
"stateMutability": "nonpayable",
|
|
99
|
+
"type": "function"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"inputs": [{ "internalType": "uint24", "name": "", "type": "uint24" }],
|
|
103
|
+
"name": "feeAmountTickSpacing",
|
|
104
|
+
"outputs": [{ "internalType": "int24", "name": "", "type": "int24" }],
|
|
105
|
+
"stateMutability": "view",
|
|
106
|
+
"type": "function"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"inputs": [
|
|
110
|
+
{ "internalType": "address", "name": "", "type": "address" },
|
|
111
|
+
{ "internalType": "address", "name": "", "type": "address" },
|
|
112
|
+
{ "internalType": "uint24", "name": "", "type": "uint24" }
|
|
113
|
+
],
|
|
114
|
+
"name": "getPool",
|
|
115
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
116
|
+
"stateMutability": "view",
|
|
117
|
+
"type": "function"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"inputs": [],
|
|
121
|
+
"name": "owner",
|
|
122
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
123
|
+
"stateMutability": "view",
|
|
124
|
+
"type": "function"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"inputs": [],
|
|
128
|
+
"name": "parameters",
|
|
129
|
+
"outputs": [
|
|
130
|
+
{ "internalType": "address", "name": "factory", "type": "address" },
|
|
131
|
+
{ "internalType": "address", "name": "token0", "type": "address" },
|
|
132
|
+
{ "internalType": "address", "name": "token1", "type": "address" },
|
|
133
|
+
{ "internalType": "uint24", "name": "fee", "type": "uint24" },
|
|
134
|
+
{ "internalType": "int24", "name": "tickSpacing", "type": "int24" }
|
|
135
|
+
],
|
|
136
|
+
"stateMutability": "view",
|
|
137
|
+
"type": "function"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"inputs": [
|
|
141
|
+
{ "internalType": "address", "name": "_owner", "type": "address" }
|
|
142
|
+
],
|
|
143
|
+
"name": "setOwner",
|
|
144
|
+
"outputs": [],
|
|
145
|
+
"stateMutability": "nonpayable",
|
|
146
|
+
"type": "function"
|
|
147
|
+
}
|
|
148
|
+
]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { DeepReadonly } from 'ts-essentials';
|
|
3
|
+
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
4
|
+
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
5
|
+
import { Address, Log, Logger } from '../../types';
|
|
6
|
+
import { LogDescription } from 'ethers/lib/utils';
|
|
7
|
+
import { FactoryState } from './types';
|
|
8
|
+
export declare type OnPoolCreatedCallback = ({ token0, token1, }: {
|
|
9
|
+
token0: string;
|
|
10
|
+
token1: string;
|
|
11
|
+
}) => Promise<void>;
|
|
12
|
+
export declare class AlgebraFactory extends StatefulEventSubscriber<FactoryState> {
|
|
13
|
+
readonly dexHelper: IDexHelper;
|
|
14
|
+
protected readonly factoryAddress: Address;
|
|
15
|
+
protected readonly onPoolCreated: OnPoolCreatedCallback;
|
|
16
|
+
handlers: {
|
|
17
|
+
[event: string]: (event: any) => Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
logDecoder: (log: Log) => any;
|
|
20
|
+
readonly factoryIface: Interface;
|
|
21
|
+
constructor(dexHelper: IDexHelper, parentName: string, factoryAddress: Address, logger: Logger, onPoolCreated: OnPoolCreatedCallback, mapKey?: string);
|
|
22
|
+
generateState(): FactoryState;
|
|
23
|
+
protected processLog(_: DeepReadonly<FactoryState>, log: Readonly<Log>): Promise<FactoryState>;
|
|
24
|
+
handleNewPool(event: LogDescription): Promise<void>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AlgebraFactory = void 0;
|
|
7
|
+
const abi_1 = require("@ethersproject/abi");
|
|
8
|
+
const AlgebraFactory_v1_1_abi_json_1 = __importDefault(require("../../abi/algebra/AlgebraFactory-v1_1.abi.json"));
|
|
9
|
+
const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
|
|
10
|
+
/*
|
|
11
|
+
* "Stateless" event subscriber in order to capture "PoolCreated" event on new pools created.
|
|
12
|
+
* State is present, but it's a placeholder to actually make the events reach handlers (if there's no previous state - `processBlockLogs` is not called)
|
|
13
|
+
*/
|
|
14
|
+
class AlgebraFactory extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
15
|
+
constructor(dexHelper, parentName, factoryAddress, logger, onPoolCreated, mapKey = '') {
|
|
16
|
+
super(parentName, `${parentName} Factory`, dexHelper, logger, true, mapKey);
|
|
17
|
+
this.dexHelper = dexHelper;
|
|
18
|
+
this.factoryAddress = factoryAddress;
|
|
19
|
+
this.onPoolCreated = onPoolCreated;
|
|
20
|
+
this.handlers = {};
|
|
21
|
+
this.factoryIface = new abi_1.Interface(AlgebraFactory_v1_1_abi_json_1.default);
|
|
22
|
+
this.addressesSubscribed = [factoryAddress];
|
|
23
|
+
this.logDecoder = (log) => this.factoryIface.parseLog(log);
|
|
24
|
+
this.handlers['Pool'] = this.handleNewPool.bind(this);
|
|
25
|
+
}
|
|
26
|
+
generateState() {
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
async processLog(_, log) {
|
|
30
|
+
const event = this.logDecoder(log);
|
|
31
|
+
if (event.name in this.handlers) {
|
|
32
|
+
await this.handlers[event.name](event);
|
|
33
|
+
}
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
async handleNewPool(event) {
|
|
37
|
+
const token0 = event.args.token0.toLowerCase();
|
|
38
|
+
const token1 = event.args.token1.toLowerCase();
|
|
39
|
+
await this.onPoolCreated({ token0, token1 });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.AlgebraFactory = AlgebraFactory;
|
|
43
|
+
//# sourceMappingURL=algebra-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"algebra-factory.js","sourceRoot":"","sources":["../../../src/dex/algebra/algebra-factory.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAE/C,kHAAwE;AAExE,+EAA0E;AAa1E;;;GAGG;AACH,MAAa,cAAe,SAAQ,mDAAqC;IASvE,YACW,SAAqB,EAC9B,UAAkB,EACC,cAAuB,EAC1C,MAAc,EACK,aAAoC,EACvD,SAAiB,EAAE;QAEnB,KAAK,CAAC,UAAU,EAAE,GAAG,UAAU,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAPnE,cAAS,GAAT,SAAS,CAAY;QAEX,mBAAc,GAAd,cAAc,CAAS;QAEvB,kBAAa,GAAb,aAAa,CAAuB;QAbzD,aAAQ,GAEJ,EAAE,CAAC;QAIS,iBAAY,GAAG,IAAI,eAAS,CAAC,sCAAU,CAAC,CAAC;QAYvD,IAAI,CAAC,mBAAmB,GAAG,CAAC,cAAc,CAAC,CAAC;QAE5C,IAAI,CAAC,UAAU,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAEhE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;IAED,aAAa;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;IAES,KAAK,CAAC,UAAU,CACxB,CAA6B,EAC7B,GAAkB;QAElB,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;YAC/B,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;SACxC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,KAAqB;QACvC,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QAC/C,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QAE/C,MAAM,IAAI,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/C,CAAC;CACF;AAhDD,wCAgDC"}
|
|
@@ -8,6 +8,7 @@ import { SimpleExchange } from '../simple-exchange';
|
|
|
8
8
|
import { Interface } from 'ethers/lib/utils';
|
|
9
9
|
import { AlgebraEventPoolV1_1 } from './algebra-pool-v1_1';
|
|
10
10
|
import { AlgebraEventPoolV1_9 } from './algebra-pool-v1_9';
|
|
11
|
+
import { OnPoolCreatedCallback } from './algebra-factory';
|
|
11
12
|
declare type IAlgebraEventPool = AlgebraEventPoolV1_1 | AlgebraEventPoolV1_9;
|
|
12
13
|
export declare class Algebra extends SimpleExchange implements IDex<AlgebraData> {
|
|
13
14
|
protected network: Network;
|
|
@@ -16,6 +17,7 @@ export declare class Algebra extends SimpleExchange implements IDex<AlgebraData>
|
|
|
16
17
|
readonly routerIface: Interface;
|
|
17
18
|
readonly quoterIface: Interface;
|
|
18
19
|
readonly config: DexParams;
|
|
20
|
+
private readonly factory;
|
|
19
21
|
readonly isFeeOnTransferSupported: boolean;
|
|
20
22
|
protected eventPools: Record<string, IAlgebraEventPool | null>;
|
|
21
23
|
readonly hasConstantPriceLargeAmounts = false;
|
|
@@ -38,6 +40,7 @@ export declare class Algebra extends SimpleExchange implements IDex<AlgebraData>
|
|
|
38
40
|
}[] | null;
|
|
39
41
|
getPoolIdentifier(srcAddress: Address, destAddress: Address): string;
|
|
40
42
|
initializePricing(blockNumber: number): Promise<void>;
|
|
43
|
+
onPoolCreatedDeleteFromNonExistingSet: OnPoolCreatedCallback;
|
|
41
44
|
getPool(srcAddress: Address, destAddress: Address, blockNumber: number): Promise<IAlgebraEventPool | null>;
|
|
42
45
|
addMasterPool(poolKey: string, blockNumber: number): Promise<boolean>;
|
|
43
46
|
getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
|
|
@@ -44,8 +44,9 @@ const types_1 = require("../uniswap-v3/types");
|
|
|
44
44
|
const AlgebraMath_1 = require("./lib/AlgebraMath");
|
|
45
45
|
const algebra_pool_v1_1_1 = require("./algebra-pool-v1_1");
|
|
46
46
|
const algebra_pool_v1_9_1 = require("./algebra-pool-v1_9");
|
|
47
|
-
const
|
|
48
|
-
const
|
|
47
|
+
const algebra_factory_1 = require("./algebra-factory");
|
|
48
|
+
const ALGEBRA_CLEAN_NOT_EXISTING_POOL_TTL_MS = 3 * 24 * 60 * 60 * 1000; // 3 days
|
|
49
|
+
const ALGEBRA_CLEAN_NOT_EXISTING_POOL_INTERVAL_MS = 24 * 60 * 60 * 1000; // Once in a day
|
|
49
50
|
const ALGEBRA_EFFICIENCY_FACTOR = 3;
|
|
50
51
|
const ALGEBRA_TICK_GAS_COST = 24000; // Ceiled
|
|
51
52
|
const ALGEBRA_TICK_BASE_OVERHEAD = 75000;
|
|
@@ -68,6 +69,26 @@ class Algebra extends simple_exchange_1.SimpleExchange {
|
|
|
68
69
|
this.eventPools = {};
|
|
69
70
|
this.hasConstantPriceLargeAmounts = false;
|
|
70
71
|
this.needWrapNative = true;
|
|
72
|
+
/*
|
|
73
|
+
* When a non existing pool is queried, it's blacklisted for an arbitrary long period in order to prevent issuing too many rpc calls
|
|
74
|
+
* Once the pool is created, it gets immediately flagged
|
|
75
|
+
*/
|
|
76
|
+
this.onPoolCreatedDeleteFromNonExistingSet = async ({ token0, token1, }) => {
|
|
77
|
+
const logPrefix = '[Algebra.onPoolCreatedDeleteFromNonExistingSet]';
|
|
78
|
+
const [_token0, _token1] = this._sortTokens(token0, token1);
|
|
79
|
+
const poolKey = `${_token0}_${_token1}`;
|
|
80
|
+
// consider doing it only from master pool for less calls to distant cache
|
|
81
|
+
// delete entry locally to let local instance discover the pool
|
|
82
|
+
delete this.eventPools[this.getPoolIdentifier(_token0, _token1)];
|
|
83
|
+
try {
|
|
84
|
+
this.logger.info(`${logPrefix} delete pool from not existing set: ${poolKey}`);
|
|
85
|
+
// delete pool record from set
|
|
86
|
+
await this.dexHelper.cache.zrem(this.notExistingPoolSetKey, [poolKey]);
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
this.logger.error(`${logPrefix} failed to delete pool from set: ${poolKey}`, error);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
71
92
|
this.logger = dexHelper.getLogger(dexKey + '-' + network);
|
|
72
93
|
this.uniswapMulti = new this.dexHelper.web3Provider.eth.Contract(UniswapMulti_abi_json_1.default, this.config.uniswapMulticall);
|
|
73
94
|
this.stateMultiContract = new this.dexHelper.web3Provider.eth.Contract(AlgebraStateMulticall_abi_json_1.default, this.config.algebraStateMulticall);
|
|
@@ -79,6 +100,7 @@ class Algebra extends simple_exchange_1.SimpleExchange {
|
|
|
79
100
|
`${constants_1.CACHE_PREFIX}_${network}_${dexKey}_not_existings_pool_set`.toLowerCase();
|
|
80
101
|
this.AlgebraPoolImplem =
|
|
81
102
|
config.version === 'v1.1' ? algebra_pool_v1_1_1.AlgebraEventPoolV1_1 : algebra_pool_v1_9_1.AlgebraEventPoolV1_9;
|
|
103
|
+
this.factory = new algebra_factory_1.AlgebraFactory(dexHelper, dexKey, this.config.factory, this.logger, this.onPoolCreatedDeleteFromNonExistingSet);
|
|
82
104
|
}
|
|
83
105
|
getAdapters(side) {
|
|
84
106
|
return this.adapters[side] ? this.adapters[side] : null;
|
|
@@ -88,11 +110,11 @@ class Algebra extends simple_exchange_1.SimpleExchange {
|
|
|
88
110
|
return `${this.dexKey}_${tokenAddresses}`;
|
|
89
111
|
}
|
|
90
112
|
async initializePricing(blockNumber) {
|
|
91
|
-
|
|
92
|
-
|
|
113
|
+
// Init listening to new pools creation
|
|
114
|
+
await this.factory.initialize(blockNumber);
|
|
93
115
|
if (!this.dexHelper.config.isSlave) {
|
|
94
116
|
const cleanExpiredNotExistingPoolsKeys = async () => {
|
|
95
|
-
const maxTimestamp = Date.now() -
|
|
117
|
+
const maxTimestamp = Date.now() - ALGEBRA_CLEAN_NOT_EXISTING_POOL_TTL_MS;
|
|
96
118
|
await this.dexHelper.cache.zremrangebyscore(this.notExistingPoolSetKey, 0, maxTimestamp);
|
|
97
119
|
};
|
|
98
120
|
this.intervalTask = setInterval(cleanExpiredNotExistingPoolsKeys.bind(this), ALGEBRA_CLEAN_NOT_EXISTING_POOL_INTERVAL_MS);
|