@nradko/metric-omm-sdk-v1 0.2.0 → 0.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/README.md +105 -18
- package/dist/abis/DepositAllowlistExtension.d.ts +440 -0
- package/dist/abis/DepositAllowlistExtension.d.ts.map +1 -0
- package/dist/abis/DepositAllowlistExtension.js +572 -0
- package/dist/abis/DepositAllowlistExtension.js.map +1 -0
- package/dist/abis/MetricOmmPool.d.ts +136 -30
- package/dist/abis/MetricOmmPool.d.ts.map +1 -1
- package/dist/abis/MetricOmmPool.js +168 -34
- package/dist/abis/MetricOmmPool.js.map +1 -1
- package/dist/abis/MetricOmmPoolDataProvider.d.ts +4 -4
- package/dist/abis/MetricOmmPoolDataProvider.js +4 -4
- package/dist/abis/MetricOmmPoolDataProvider.js.map +1 -1
- package/dist/abis/MetricOmmPoolFactory.d.ts +76 -18
- package/dist/abis/MetricOmmPoolFactory.d.ts.map +1 -1
- package/dist/abis/MetricOmmPoolFactory.js +93 -19
- package/dist/abis/MetricOmmPoolFactory.js.map +1 -1
- package/dist/abis/MetricOmmPoolLiquidityAdder.d.ts +68 -8
- package/dist/abis/MetricOmmPoolLiquidityAdder.d.ts.map +1 -1
- package/dist/abis/MetricOmmPoolLiquidityAdder.js +85 -9
- package/dist/abis/MetricOmmPoolLiquidityAdder.js.map +1 -1
- package/dist/abis/MetricOmmPoolSwapper.d.ts +8 -8
- package/dist/abis/MetricOmmPoolSwapper.js +8 -8
- package/dist/abis/MetricOmmPoolSwapper.js.map +1 -1
- package/dist/abis/OracleValueStopLossExtension.d.ts +936 -0
- package/dist/abis/OracleValueStopLossExtension.d.ts.map +1 -0
- package/dist/abis/OracleValueStopLossExtension.js +1214 -0
- package/dist/abis/OracleValueStopLossExtension.js.map +1 -0
- package/dist/abis/PriceProvider.d.ts +1 -113
- package/dist/abis/PriceProvider.d.ts.map +1 -1
- package/dist/abis/PriceProvider.js +1 -146
- package/dist/abis/PriceProvider.js.map +1 -1
- package/dist/abis/PriceVelocityGuardExtension.d.ts +454 -0
- package/dist/abis/PriceVelocityGuardExtension.d.ts.map +1 -0
- package/dist/abis/PriceVelocityGuardExtension.js +590 -0
- package/dist/abis/PriceVelocityGuardExtension.js.map +1 -0
- package/dist/abis/SwapAllowlistExtension.d.ts +440 -0
- package/dist/abis/SwapAllowlistExtension.d.ts.map +1 -0
- package/dist/abis/SwapAllowlistExtension.js +572 -0
- package/dist/abis/SwapAllowlistExtension.js.map +1 -0
- package/dist/abis/index.d.ts +4 -0
- package/dist/abis/index.d.ts.map +1 -1
- package/dist/abis/index.js +4 -0
- package/dist/abis/index.js.map +1 -1
- package/dist/addresses.d.ts +13 -6
- package/dist/addresses.d.ts.map +1 -1
- package/dist/addresses.js +33 -16
- package/dist/addresses.js.map +1 -1
- package/dist/extensions/admin/depositAllowlist.d.ts +8 -0
- package/dist/extensions/admin/depositAllowlist.d.ts.map +1 -0
- package/dist/extensions/admin/depositAllowlist.js +10 -0
- package/dist/extensions/admin/depositAllowlist.js.map +1 -0
- package/dist/extensions/admin/oracleStopLoss.d.ts +56 -0
- package/dist/extensions/admin/oracleStopLoss.d.ts.map +1 -0
- package/dist/extensions/admin/oracleStopLoss.js +87 -0
- package/dist/extensions/admin/oracleStopLoss.js.map +1 -0
- package/dist/extensions/admin/priceVelocityGuard.d.ts +12 -0
- package/dist/extensions/admin/priceVelocityGuard.d.ts.map +1 -0
- package/dist/extensions/admin/priceVelocityGuard.js +17 -0
- package/dist/extensions/admin/priceVelocityGuard.js.map +1 -0
- package/dist/extensions/admin/swapAllowlist.d.ts +8 -0
- package/dist/extensions/admin/swapAllowlist.d.ts.map +1 -0
- package/dist/extensions/admin/swapAllowlist.js +10 -0
- package/dist/extensions/admin/swapAllowlist.js.map +1 -0
- package/dist/extensions/index.d.ts +8 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +8 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/extensions/init/index.d.ts +13 -0
- package/dist/extensions/init/index.d.ts.map +1 -0
- package/dist/extensions/init/index.js +12 -0
- package/dist/extensions/init/index.js.map +1 -0
- package/dist/extensions/orders.d.ts +7 -0
- package/dist/extensions/orders.d.ts.map +1 -0
- package/dist/extensions/orders.js +24 -0
- package/dist/extensions/orders.js.map +1 -0
- package/dist/extensions/types.d.ts +23 -0
- package/dist/extensions/types.d.ts.map +1 -0
- package/dist/extensions/types.js +10 -0
- package/dist/extensions/types.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/pool/create.d.ts +11 -6
- package/dist/pool/create.d.ts.map +1 -1
- package/dist/pool/create.js +5 -3
- package/dist/pool/create.js.map +1 -1
- package/dist/pool/index.d.ts +1 -1
- package/dist/pool/index.d.ts.map +1 -1
- package/dist/pool/index.js.map +1 -1
- package/dist/pool/liquidity.d.ts +13 -5
- package/dist/pool/liquidity.d.ts.map +1 -1
- package/dist/pool/liquidity.js +25 -10
- package/dist/pool/liquidity.js.map +1 -1
- package/dist/pool/read.d.ts +0 -6
- package/dist/pool/read.d.ts.map +1 -1
- package/dist/pool/read.js +21 -14
- package/dist/pool/read.js.map +1 -1
- package/dist/router/swap.d.ts +1 -1
- package/dist/router/swap.d.ts.map +1 -1
- package/dist/router/swap.js +14 -14
- package/dist/router/swap.js.map +1 -1
- package/dist/types.d.ts +3 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -5
- package/src/abis/DepositAllowlistExtension.ts +571 -0
- package/src/abis/MetricOmmPool.ts +168 -34
- package/src/abis/MetricOmmPoolDataProvider.ts +4 -4
- package/src/abis/MetricOmmPoolFactory.ts +93 -19
- package/src/abis/MetricOmmPoolLiquidityAdder.ts +85 -9
- package/src/abis/MetricOmmPoolSwapper.ts +8 -8
- package/src/abis/OracleValueStopLossExtension.ts +1213 -0
- package/src/abis/PriceProvider.ts +1 -146
- package/src/abis/PriceVelocityGuardExtension.ts +589 -0
- package/src/abis/SwapAllowlistExtension.ts +571 -0
- package/src/abis/index.ts +4 -0
- package/src/addresses.ts +44 -18
- package/src/extensions/admin/depositAllowlist.ts +16 -0
- package/src/extensions/admin/oracleStopLoss.ts +141 -0
- package/src/extensions/admin/priceVelocityGuard.ts +27 -0
- package/src/extensions/admin/swapAllowlist.ts +16 -0
- package/src/extensions/index.ts +31 -0
- package/src/extensions/init/index.ts +21 -0
- package/src/extensions/orders.ts +33 -0
- package/src/extensions/types.ts +33 -0
- package/src/index.ts +33 -0
- package/src/pool/create.ts +12 -8
- package/src/pool/index.ts +1 -0
- package/src/pool/liquidity.ts +41 -15
- package/src/pool/read.ts +34 -16
- package/src/router/swap.ts +16 -16
- package/src/types.ts +3 -4
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
export const SwapAllowlistExtensionAbi = [
|
|
2
|
+
{
|
|
3
|
+
inputs: [
|
|
4
|
+
{
|
|
5
|
+
internalType: "address",
|
|
6
|
+
name: "factory_",
|
|
7
|
+
type: "address",
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
stateMutability: "nonpayable",
|
|
11
|
+
type: "constructor",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
inputs: [],
|
|
15
|
+
name: "ExtensionNotImplemented",
|
|
16
|
+
type: "error",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
inputs: [],
|
|
20
|
+
name: "NotAllowedToSwap",
|
|
21
|
+
type: "error",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
inputs: [
|
|
25
|
+
{
|
|
26
|
+
internalType: "address",
|
|
27
|
+
name: "caller",
|
|
28
|
+
type: "address",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
internalType: "address",
|
|
32
|
+
name: "factory",
|
|
33
|
+
type: "address",
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
name: "OnlyFactory",
|
|
37
|
+
type: "error",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
inputs: [
|
|
41
|
+
{
|
|
42
|
+
internalType: "address",
|
|
43
|
+
name: "caller",
|
|
44
|
+
type: "address",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
internalType: "address",
|
|
48
|
+
name: "factory",
|
|
49
|
+
type: "address",
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
name: "OnlyPool",
|
|
53
|
+
type: "error",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
inputs: [
|
|
57
|
+
{
|
|
58
|
+
internalType: "address",
|
|
59
|
+
name: "pool",
|
|
60
|
+
type: "address",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
internalType: "address",
|
|
64
|
+
name: "caller",
|
|
65
|
+
type: "address",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
internalType: "address",
|
|
69
|
+
name: "admin",
|
|
70
|
+
type: "address",
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
name: "OnlyPoolAdmin",
|
|
74
|
+
type: "error",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
anonymous: false,
|
|
78
|
+
inputs: [
|
|
79
|
+
{
|
|
80
|
+
indexed: true,
|
|
81
|
+
internalType: "address",
|
|
82
|
+
name: "pool",
|
|
83
|
+
type: "address",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
indexed: true,
|
|
87
|
+
internalType: "address",
|
|
88
|
+
name: "swapper",
|
|
89
|
+
type: "address",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
indexed: false,
|
|
93
|
+
internalType: "bool",
|
|
94
|
+
name: "allowed",
|
|
95
|
+
type: "bool",
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
name: "AllowedToSwapSet",
|
|
99
|
+
type: "event",
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
inputs: [],
|
|
103
|
+
name: "FACTORY",
|
|
104
|
+
outputs: [
|
|
105
|
+
{
|
|
106
|
+
internalType: "address",
|
|
107
|
+
name: "",
|
|
108
|
+
type: "address",
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
stateMutability: "view",
|
|
112
|
+
type: "function",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
inputs: [
|
|
116
|
+
{
|
|
117
|
+
internalType: "address",
|
|
118
|
+
name: "",
|
|
119
|
+
type: "address",
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
internalType: "address",
|
|
123
|
+
name: "",
|
|
124
|
+
type: "address",
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
internalType: "uint80",
|
|
128
|
+
name: "",
|
|
129
|
+
type: "uint80",
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
components: [
|
|
133
|
+
{
|
|
134
|
+
internalType: "int256[]",
|
|
135
|
+
name: "binIdxs",
|
|
136
|
+
type: "int256[]",
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
internalType: "uint256[]",
|
|
140
|
+
name: "shares",
|
|
141
|
+
type: "uint256[]",
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
internalType: "struct LiquidityDelta",
|
|
145
|
+
name: "",
|
|
146
|
+
type: "tuple",
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
internalType: "uint256",
|
|
150
|
+
name: "",
|
|
151
|
+
type: "uint256",
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
internalType: "uint256",
|
|
155
|
+
name: "",
|
|
156
|
+
type: "uint256",
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
internalType: "bytes",
|
|
160
|
+
name: "",
|
|
161
|
+
type: "bytes",
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
name: "afterAddLiquidity",
|
|
165
|
+
outputs: [
|
|
166
|
+
{
|
|
167
|
+
internalType: "bytes4",
|
|
168
|
+
name: "",
|
|
169
|
+
type: "bytes4",
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
stateMutability: "nonpayable",
|
|
173
|
+
type: "function",
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
inputs: [
|
|
177
|
+
{
|
|
178
|
+
internalType: "address",
|
|
179
|
+
name: "",
|
|
180
|
+
type: "address",
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
internalType: "address",
|
|
184
|
+
name: "",
|
|
185
|
+
type: "address",
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
internalType: "uint80",
|
|
189
|
+
name: "",
|
|
190
|
+
type: "uint80",
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
components: [
|
|
194
|
+
{
|
|
195
|
+
internalType: "int256[]",
|
|
196
|
+
name: "binIdxs",
|
|
197
|
+
type: "int256[]",
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
internalType: "uint256[]",
|
|
201
|
+
name: "shares",
|
|
202
|
+
type: "uint256[]",
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
internalType: "struct LiquidityDelta",
|
|
206
|
+
name: "",
|
|
207
|
+
type: "tuple",
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
internalType: "uint256",
|
|
211
|
+
name: "",
|
|
212
|
+
type: "uint256",
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
internalType: "uint256",
|
|
216
|
+
name: "",
|
|
217
|
+
type: "uint256",
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
internalType: "bytes",
|
|
221
|
+
name: "",
|
|
222
|
+
type: "bytes",
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
name: "afterRemoveLiquidity",
|
|
226
|
+
outputs: [
|
|
227
|
+
{
|
|
228
|
+
internalType: "bytes4",
|
|
229
|
+
name: "",
|
|
230
|
+
type: "bytes4",
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
stateMutability: "nonpayable",
|
|
234
|
+
type: "function",
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
inputs: [
|
|
238
|
+
{
|
|
239
|
+
internalType: "address",
|
|
240
|
+
name: "",
|
|
241
|
+
type: "address",
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
internalType: "address",
|
|
245
|
+
name: "",
|
|
246
|
+
type: "address",
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
internalType: "bool",
|
|
250
|
+
name: "",
|
|
251
|
+
type: "bool",
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
internalType: "int128",
|
|
255
|
+
name: "",
|
|
256
|
+
type: "int128",
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
internalType: "uint128",
|
|
260
|
+
name: "",
|
|
261
|
+
type: "uint128",
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
internalType: "uint256",
|
|
265
|
+
name: "",
|
|
266
|
+
type: "uint256",
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
internalType: "uint256",
|
|
270
|
+
name: "",
|
|
271
|
+
type: "uint256",
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
internalType: "uint128",
|
|
275
|
+
name: "",
|
|
276
|
+
type: "uint128",
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
internalType: "uint128",
|
|
280
|
+
name: "",
|
|
281
|
+
type: "uint128",
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
internalType: "int128",
|
|
285
|
+
name: "",
|
|
286
|
+
type: "int128",
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
internalType: "int128",
|
|
290
|
+
name: "",
|
|
291
|
+
type: "int128",
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
internalType: "uint256",
|
|
295
|
+
name: "",
|
|
296
|
+
type: "uint256",
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
internalType: "bytes",
|
|
300
|
+
name: "",
|
|
301
|
+
type: "bytes",
|
|
302
|
+
},
|
|
303
|
+
],
|
|
304
|
+
name: "afterSwap",
|
|
305
|
+
outputs: [
|
|
306
|
+
{
|
|
307
|
+
internalType: "bytes4",
|
|
308
|
+
name: "",
|
|
309
|
+
type: "bytes4",
|
|
310
|
+
},
|
|
311
|
+
],
|
|
312
|
+
stateMutability: "nonpayable",
|
|
313
|
+
type: "function",
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
inputs: [
|
|
317
|
+
{
|
|
318
|
+
internalType: "address",
|
|
319
|
+
name: "pool",
|
|
320
|
+
type: "address",
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
internalType: "address",
|
|
324
|
+
name: "swapper",
|
|
325
|
+
type: "address",
|
|
326
|
+
},
|
|
327
|
+
],
|
|
328
|
+
name: "allowedSwapper",
|
|
329
|
+
outputs: [
|
|
330
|
+
{
|
|
331
|
+
internalType: "bool",
|
|
332
|
+
name: "",
|
|
333
|
+
type: "bool",
|
|
334
|
+
},
|
|
335
|
+
],
|
|
336
|
+
stateMutability: "view",
|
|
337
|
+
type: "function",
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
inputs: [
|
|
341
|
+
{
|
|
342
|
+
internalType: "address",
|
|
343
|
+
name: "",
|
|
344
|
+
type: "address",
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
internalType: "address",
|
|
348
|
+
name: "",
|
|
349
|
+
type: "address",
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
internalType: "uint80",
|
|
353
|
+
name: "",
|
|
354
|
+
type: "uint80",
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
components: [
|
|
358
|
+
{
|
|
359
|
+
internalType: "int256[]",
|
|
360
|
+
name: "binIdxs",
|
|
361
|
+
type: "int256[]",
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
internalType: "uint256[]",
|
|
365
|
+
name: "shares",
|
|
366
|
+
type: "uint256[]",
|
|
367
|
+
},
|
|
368
|
+
],
|
|
369
|
+
internalType: "struct LiquidityDelta",
|
|
370
|
+
name: "",
|
|
371
|
+
type: "tuple",
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
internalType: "bytes",
|
|
375
|
+
name: "",
|
|
376
|
+
type: "bytes",
|
|
377
|
+
},
|
|
378
|
+
],
|
|
379
|
+
name: "beforeAddLiquidity",
|
|
380
|
+
outputs: [
|
|
381
|
+
{
|
|
382
|
+
internalType: "bytes4",
|
|
383
|
+
name: "",
|
|
384
|
+
type: "bytes4",
|
|
385
|
+
},
|
|
386
|
+
],
|
|
387
|
+
stateMutability: "nonpayable",
|
|
388
|
+
type: "function",
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
inputs: [
|
|
392
|
+
{
|
|
393
|
+
internalType: "address",
|
|
394
|
+
name: "",
|
|
395
|
+
type: "address",
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
internalType: "address",
|
|
399
|
+
name: "",
|
|
400
|
+
type: "address",
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
internalType: "uint80",
|
|
404
|
+
name: "",
|
|
405
|
+
type: "uint80",
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
components: [
|
|
409
|
+
{
|
|
410
|
+
internalType: "int256[]",
|
|
411
|
+
name: "binIdxs",
|
|
412
|
+
type: "int256[]",
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
internalType: "uint256[]",
|
|
416
|
+
name: "shares",
|
|
417
|
+
type: "uint256[]",
|
|
418
|
+
},
|
|
419
|
+
],
|
|
420
|
+
internalType: "struct LiquidityDelta",
|
|
421
|
+
name: "",
|
|
422
|
+
type: "tuple",
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
internalType: "bytes",
|
|
426
|
+
name: "",
|
|
427
|
+
type: "bytes",
|
|
428
|
+
},
|
|
429
|
+
],
|
|
430
|
+
name: "beforeRemoveLiquidity",
|
|
431
|
+
outputs: [
|
|
432
|
+
{
|
|
433
|
+
internalType: "bytes4",
|
|
434
|
+
name: "",
|
|
435
|
+
type: "bytes4",
|
|
436
|
+
},
|
|
437
|
+
],
|
|
438
|
+
stateMutability: "nonpayable",
|
|
439
|
+
type: "function",
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
inputs: [
|
|
443
|
+
{
|
|
444
|
+
internalType: "address",
|
|
445
|
+
name: "sender",
|
|
446
|
+
type: "address",
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
internalType: "address",
|
|
450
|
+
name: "",
|
|
451
|
+
type: "address",
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
internalType: "bool",
|
|
455
|
+
name: "",
|
|
456
|
+
type: "bool",
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
internalType: "int128",
|
|
460
|
+
name: "",
|
|
461
|
+
type: "int128",
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
internalType: "uint128",
|
|
465
|
+
name: "",
|
|
466
|
+
type: "uint128",
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
internalType: "uint256",
|
|
470
|
+
name: "",
|
|
471
|
+
type: "uint256",
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
internalType: "uint128",
|
|
475
|
+
name: "",
|
|
476
|
+
type: "uint128",
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
internalType: "uint128",
|
|
480
|
+
name: "",
|
|
481
|
+
type: "uint128",
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
internalType: "bytes",
|
|
485
|
+
name: "",
|
|
486
|
+
type: "bytes",
|
|
487
|
+
},
|
|
488
|
+
],
|
|
489
|
+
name: "beforeSwap",
|
|
490
|
+
outputs: [
|
|
491
|
+
{
|
|
492
|
+
internalType: "bytes4",
|
|
493
|
+
name: "",
|
|
494
|
+
type: "bytes4",
|
|
495
|
+
},
|
|
496
|
+
],
|
|
497
|
+
stateMutability: "view",
|
|
498
|
+
type: "function",
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
inputs: [
|
|
502
|
+
{
|
|
503
|
+
internalType: "address",
|
|
504
|
+
name: "",
|
|
505
|
+
type: "address",
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
internalType: "bytes",
|
|
509
|
+
name: "",
|
|
510
|
+
type: "bytes",
|
|
511
|
+
},
|
|
512
|
+
],
|
|
513
|
+
name: "initialize",
|
|
514
|
+
outputs: [
|
|
515
|
+
{
|
|
516
|
+
internalType: "bytes4",
|
|
517
|
+
name: "",
|
|
518
|
+
type: "bytes4",
|
|
519
|
+
},
|
|
520
|
+
],
|
|
521
|
+
stateMutability: "nonpayable",
|
|
522
|
+
type: "function",
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
inputs: [
|
|
526
|
+
{
|
|
527
|
+
internalType: "address",
|
|
528
|
+
name: "pool_",
|
|
529
|
+
type: "address",
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
internalType: "address",
|
|
533
|
+
name: "swapper",
|
|
534
|
+
type: "address",
|
|
535
|
+
},
|
|
536
|
+
],
|
|
537
|
+
name: "isAllowedToSwap",
|
|
538
|
+
outputs: [
|
|
539
|
+
{
|
|
540
|
+
internalType: "bool",
|
|
541
|
+
name: "",
|
|
542
|
+
type: "bool",
|
|
543
|
+
},
|
|
544
|
+
],
|
|
545
|
+
stateMutability: "view",
|
|
546
|
+
type: "function",
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
inputs: [
|
|
550
|
+
{
|
|
551
|
+
internalType: "address",
|
|
552
|
+
name: "pool_",
|
|
553
|
+
type: "address",
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
internalType: "address",
|
|
557
|
+
name: "swapper",
|
|
558
|
+
type: "address",
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
internalType: "bool",
|
|
562
|
+
name: "allowed",
|
|
563
|
+
type: "bool",
|
|
564
|
+
},
|
|
565
|
+
],
|
|
566
|
+
name: "setAllowedToSwap",
|
|
567
|
+
outputs: [],
|
|
568
|
+
stateMutability: "nonpayable",
|
|
569
|
+
type: "function",
|
|
570
|
+
},
|
|
571
|
+
] as const;
|
package/src/abis/index.ts
CHANGED
|
@@ -7,5 +7,9 @@ export { MetricOmmPoolDataProviderAbi } from "./MetricOmmPoolDataProvider.js";
|
|
|
7
7
|
export { MetricOmmPoolSwapperAbi } from "./MetricOmmPoolSwapper.js";
|
|
8
8
|
export { MetricOmmPoolLiquidityAdderAbi } from "./MetricOmmPoolLiquidityAdder.js";
|
|
9
9
|
export { MetricOmmPoolFactoryAbi } from "./MetricOmmPoolFactory.js";
|
|
10
|
+
export { DepositAllowlistExtensionAbi } from "./DepositAllowlistExtension.js";
|
|
11
|
+
export { SwapAllowlistExtensionAbi } from "./SwapAllowlistExtension.js";
|
|
12
|
+
export { PriceVelocityGuardExtensionAbi } from "./PriceVelocityGuardExtension.js";
|
|
13
|
+
export { OracleValueStopLossExtensionAbi } from "./OracleValueStopLossExtension.js";
|
|
10
14
|
export { PriceProviderAbi } from "./PriceProvider.js";
|
|
11
15
|
export { PriceProviderUiAbi } from "./PriceProviderUi.js";
|
package/src/addresses.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MetricAMM SDK — v1 deployed addresses.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* Pool state reads (slot0, bins, position shares) and depth/quote views use
|
|
4
|
+
* Ethereum mainnet and Base use the same protocol deployment addresses (CREATE2).
|
|
5
|
+
* Pool state reads (slot0, bins, position shares) and depth/quote views use dataProvider
|
|
6
6
|
* (MetricOmmPoolDataProvider — the single deployed lens per factory).
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -24,8 +24,8 @@ export const ChainId = {
|
|
|
24
24
|
|
|
25
25
|
export type ChainId = (typeof ChainId)[keyof typeof ChainId];
|
|
26
26
|
|
|
27
|
-
/** Chains that have entries in
|
|
28
|
-
export type DeployedChainId = typeof ChainId.ETHEREUM;
|
|
27
|
+
/** Chains that have entries in ADDRESSES for this SDK release. */
|
|
28
|
+
export type DeployedChainId = typeof ChainId.ETHEREUM | typeof ChainId.BASE;
|
|
29
29
|
|
|
30
30
|
// ============ Contract Address Types ============
|
|
31
31
|
|
|
@@ -44,49 +44,75 @@ export interface ChainAddresses {
|
|
|
44
44
|
simpleRouter: Address;
|
|
45
45
|
/** MetricOmmPoolSwapper */
|
|
46
46
|
swapper: Address;
|
|
47
|
-
/** Wrapped native (WETH on Ethereum) */
|
|
47
|
+
/** Wrapped native (WETH on Ethereum / Base) */
|
|
48
48
|
wrappedNative: Address;
|
|
49
|
+
|
|
50
|
+
/** Per-pool extensions (configure at pool creation). */
|
|
51
|
+
extensions: {
|
|
52
|
+
depositAllowlistExtension: Address;
|
|
53
|
+
swapAllowlistExtension: Address;
|
|
54
|
+
oracleValueStopLossExtension: Address;
|
|
55
|
+
priceVelocityGuardExtension: Address;
|
|
56
|
+
};
|
|
49
57
|
}
|
|
50
58
|
|
|
51
59
|
// ============ Deployed addresses ============
|
|
52
60
|
|
|
53
|
-
/**
|
|
61
|
+
/** Shared protocol deployment (Ethereum + Base). */
|
|
62
|
+
const PROTOCOL_ADDRESSES = {
|
|
63
|
+
factory: "0x175851292f22621F337D76fE5445e9372fb06f9C",
|
|
64
|
+
poolDeployer: "0x1C0502457231fF2BE9af4468115B33c112A580eF",
|
|
65
|
+
liquidityAdder: "0x7A2C0A39A48c526F1Cae4d67cb0e7aE883A7B623",
|
|
66
|
+
dataProvider: "0xD0C4df72910Fd70C89CBa5f0FE0ef45638D12775",
|
|
67
|
+
stateView: "0xb40F8B0cfBB6a01c3232c6D063B1F87d1C0bE40f",
|
|
68
|
+
simpleRouter: "0x818a948B25f32F41547a7B9175cB174d2B1e6AD7",
|
|
69
|
+
swapper: "0x3B8F17A4cb4f91805338f4b6c2f2aAf94243587e",
|
|
70
|
+
extensions: {
|
|
71
|
+
depositAllowlistExtension: "0xa56f616c1C8108750b8a5BF387a34C757B8Bdc2c",
|
|
72
|
+
swapAllowlistExtension: "0x1aee646900bE4aa1D0A7Ec6c98483923E1aBf481",
|
|
73
|
+
oracleValueStopLossExtension: "0x3CB3EdCce50Bdc95e746F6e7C23fd61d439fA02a",
|
|
74
|
+
priceVelocityGuardExtension: "0x65D5C490fF5Df1861D966A671dB43a8d0c22b9C4",
|
|
75
|
+
},
|
|
76
|
+
} as const satisfies Omit<ChainAddresses, "wrappedNative">;
|
|
77
|
+
|
|
78
|
+
/** Extensions-era deployment — Ethereum mainnet and Base (Jun 2026). */
|
|
54
79
|
export const ADDRESSES: Record<DeployedChainId, ChainAddresses> = {
|
|
55
80
|
[ChainId.ETHEREUM]: {
|
|
56
|
-
|
|
57
|
-
poolDeployer: "0xb9bb9364FEA5170713709Ba67Aec649eF043e885",
|
|
58
|
-
liquidityAdder: "0x9de47a0C84c7F9486Af77C8135CE7f480d121B44",
|
|
59
|
-
dataProvider: "0xf06454dB7E9b8BCa2FC77bF6e88f9B98dF0b52e8",
|
|
60
|
-
stateView: "0x124C2853E316d1585621560E35D4dcC8318F97FF",
|
|
61
|
-
simpleRouter: "0x94DD3A9308A1060f4BD9A95dE65F27f0F048f863",
|
|
62
|
-
swapper: "0xc73407A1d240e08EB34654e706cc3B19E356b8C4",
|
|
81
|
+
...PROTOCOL_ADDRESSES,
|
|
63
82
|
wrappedNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
64
83
|
},
|
|
84
|
+
[ChainId.BASE]: {
|
|
85
|
+
...PROTOCOL_ADDRESSES,
|
|
86
|
+
wrappedNative: "0x4200000000000000000000000000000000000006",
|
|
87
|
+
},
|
|
65
88
|
} as const;
|
|
66
89
|
|
|
67
90
|
// ============ Helper Functions ============
|
|
68
91
|
|
|
92
|
+
const DEPLOYED_CHAIN_IDS: readonly DeployedChainId[] = [ChainId.ETHEREUM, ChainId.BASE];
|
|
93
|
+
|
|
69
94
|
export function getAddresses(chainId: number): ChainAddresses | undefined {
|
|
70
|
-
if (chainId
|
|
71
|
-
return ADDRESSES[ChainId.
|
|
95
|
+
if (chainId === ChainId.ETHEREUM) return ADDRESSES[ChainId.ETHEREUM];
|
|
96
|
+
if (chainId === ChainId.BASE) return ADDRESSES[ChainId.BASE];
|
|
97
|
+
return undefined;
|
|
72
98
|
}
|
|
73
99
|
|
|
74
100
|
export function getAddressesOrThrow(chainId: number): ChainAddresses {
|
|
75
101
|
const addresses = getAddresses(chainId);
|
|
76
102
|
if (!addresses) {
|
|
77
103
|
throw new Error(
|
|
78
|
-
`Chain ${chainId} has no v1 deployment in this SDK (
|
|
104
|
+
`Chain ${chainId} has no v1 deployment in this SDK (Ethereum and Base are configured)`,
|
|
79
105
|
);
|
|
80
106
|
}
|
|
81
107
|
return addresses;
|
|
82
108
|
}
|
|
83
109
|
|
|
84
110
|
export function isChainSupported(chainId: number): chainId is DeployedChainId {
|
|
85
|
-
return chainId === ChainId.ETHEREUM;
|
|
111
|
+
return chainId === ChainId.ETHEREUM || chainId === ChainId.BASE;
|
|
86
112
|
}
|
|
87
113
|
|
|
88
114
|
export function getSupportedChainIds(): DeployedChainId[] {
|
|
89
|
-
return [
|
|
115
|
+
return [...DEPLOYED_CHAIN_IDS];
|
|
90
116
|
}
|
|
91
117
|
|
|
92
118
|
export function isChainDeployed(chainId: number): boolean {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Address, Hex } from "viem";
|
|
2
|
+
import { encodeFunctionData } from "viem";
|
|
3
|
+
import { DepositAllowlistExtensionAbi } from "../../abis/DepositAllowlistExtension.js";
|
|
4
|
+
|
|
5
|
+
export function encodeSetAllowedToDepositCalldata(params: {
|
|
6
|
+
extension: Address;
|
|
7
|
+
pool: Address;
|
|
8
|
+
depositor: Address;
|
|
9
|
+
allowed: boolean;
|
|
10
|
+
}): Hex {
|
|
11
|
+
return encodeFunctionData({
|
|
12
|
+
abi: DepositAllowlistExtensionAbi,
|
|
13
|
+
functionName: "setAllowedToDeposit",
|
|
14
|
+
args: [params.pool, params.depositor, params.allowed],
|
|
15
|
+
});
|
|
16
|
+
}
|