@paraswap/dex-lib 2.21.0 → 2.21.1
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/dex/curve-v1-factory/config.js +91 -9
- package/build/dex/curve-v1-factory/config.js.map +1 -1
- package/build/dex/curve-v1-factory/curve-v1-factory.js +9 -3
- package/build/dex/curve-v1-factory/curve-v1-factory.js.map +1 -1
- package/build/dex/curve-v1-factory/curve-v1-pool-manager.js +2 -0
- package/build/dex/curve-v1-factory/curve-v1-pool-manager.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_calc_withdraw_one_coin.js +27 -3
- package/build/dex/curve-v1-factory/price-handlers/functions/_calc_withdraw_one_coin.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_dynamic_fee.js +6 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/_dynamic_fee.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_rates.js +6 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/_rates.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_xp.js +6 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/_xp.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_xp_mem.js +6 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/_xp_mem.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/calc_token_amount.js +6 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/calc_token_amount.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/calc_withdraw_one_coin.js +6 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/calc_withdraw_one_coin.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/constants.js +66 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/constants.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D.js +6 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D_mem.js +20 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D_mem.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D_precisions.js +6 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D_precisions.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_dy.js +26 -3
- package/build/dex/curve-v1-factory/price-handlers/functions/get_dy.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_dy_underlying.js +6 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_dy_underlying.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_y.js +6 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_y.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_y_D.js +6 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_y_D.js.map +1 -1
- package/build/dex/curve-v1-factory/state-polling-pools/custom-pool-polling.d.ts +1 -4
- package/build/dex/curve-v1-factory/state-polling-pools/custom-pool-polling.js +2 -5
- package/build/dex/curve-v1-factory/state-polling-pools/custom-pool-polling.js.map +1 -1
- package/build/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.d.ts +3 -1
- package/build/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.js +22 -3
- package/build/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.js.map +1 -1
- package/build/dex/curve-v1-factory/state-polling-pools/polling-manager.d.ts +1 -1
- package/build/dex/curve-v1-factory/state-polling-pools/polling-manager.js +28 -3
- package/build/dex/curve-v1-factory/state-polling-pools/polling-manager.js.map +1 -1
- package/build/dex/curve-v1-factory/state-polling-pools/pool-polling-base.d.ts +2 -1
- package/build/dex/curve-v1-factory/state-polling-pools/pool-polling-base.js +2 -1
- package/build/dex/curve-v1-factory/state-polling-pools/pool-polling-base.js.map +1 -1
- package/build/dex/curve-v1-factory/types.d.ts +16 -0
- package/build/dex/curve-v1-factory/types.js +6 -0
- package/build/dex/curve-v1-factory/types.js.map +1 -1
- package/build/dex/swaap-v2/rate-fetcher.js.map +1 -1
- package/build/dex/test-dex/config.d.ts +4 -0
- package/build/dex/test-dex/config.js +15 -0
- package/build/dex/test-dex/config.js.map +1 -0
- package/build/dex/test-dex/test-dex-pool.d.ts +39 -0
- package/build/dex/test-dex/test-dex-pool.js +63 -0
- package/build/dex/test-dex/test-dex-pool.js.map +1 -0
- package/build/dex/test-dex/test-dex.d.ts +37 -0
- package/build/dex/test-dex/test-dex.js +126 -0
- package/build/dex/test-dex/test-dex.js.map +1 -0
- package/build/dex/test-dex/types.d.ts +6 -0
- package/build/dex/{pancakeswap-v3 → test-dex}/types.js.map +1 -1
- package/build/dex/woo-fi-v2/woo-fi-math.d.ts +16 -0
- package/build/dex/woo-fi-v2/woo-fi-math.js +137 -0
- package/build/dex/woo-fi-v2/woo-fi-math.js.map +1 -0
- package/package.json +1 -1
- package/src/dex/curve-v1-factory/config.ts +91 -9
- package/src/dex/curve-v1-factory/curve-v1-factory-e2e.test.ts +36 -0
- package/src/dex/curve-v1-factory/curve-v1-factory.ts +12 -1
- package/src/dex/curve-v1-factory/curve-v1-pool-manager.ts +6 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/_calc_withdraw_one_coin.ts +53 -6
- package/src/dex/curve-v1-factory/price-handlers/functions/_dynamic_fee.ts +7 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/_rates.ts +7 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/_xp.ts +7 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/_xp_mem.ts +7 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/calc_token_amount.ts +7 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/calc_withdraw_one_coin.ts +7 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/constants.ts +78 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_D.ts +13 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_D_mem.ts +40 -3
- package/src/dex/curve-v1-factory/price-handlers/functions/get_D_precisions.ts +7 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_dy.ts +53 -4
- package/src/dex/curve-v1-factory/price-handlers/functions/get_dy_underlying.ts +7 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_y.ts +7 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_y_D.ts +7 -0
- package/src/dex/curve-v1-factory/state-polling-pools/custom-pool-polling.ts +5 -3
- package/src/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.ts +42 -1
- package/src/dex/curve-v1-factory/state-polling-pools/polling-manager.ts +43 -9
- package/src/dex/curve-v1-factory/state-polling-pools/pool-polling-base.ts +1 -0
- package/src/dex/curve-v1-factory/types.ts +14 -0
- package/src/dex/quickswap/quickswap-e2e.test.ts +1 -1
- package/src/dex/swaap-v2/rate-fetcher.ts +10 -10
- package/src/dex/swaap-v2/swaap-v2-e2e.test.ts +1 -4
- package/tests/constants-e2e.ts +6 -10
- package/.idea/aws.xml +0 -17
- package/.idea/codeStyles/Project.xml +0 -19
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/paraswap-dex-lib.iml +0 -9
- package/.idea/vcs.xml +0 -6
- package/build/dex/pancakeswap-v3/types.d.ts +0 -14
- package/build/dex/solidly/forks-override/chronos.d.ts +0 -20
- package/build/dex/solidly/forks-override/chronos.js +0 -44
- package/build/dex/solidly/forks-override/chronos.js.map +0 -1
- /package/build/dex/{pancakeswap-v3 → test-dex}/types.js +0 -0
|
@@ -15,7 +15,9 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
15
15
|
[Network.MAINNET]: {
|
|
16
16
|
factoryAddress: '0xB9fC157394Af804a3578134A6585C0dc9cc990d4',
|
|
17
17
|
stateUpdatePeriodMs: 5 * 1000,
|
|
18
|
-
disabledPools: new Set([
|
|
18
|
+
disabledPools: new Set([
|
|
19
|
+
'0x28B0Cf1baFB707F2c6826d10caf6DD901a6540C5', // It is rug pool token
|
|
20
|
+
]),
|
|
19
21
|
disabledImplementations: new Set([]),
|
|
20
22
|
factoryPoolImplementations: {
|
|
21
23
|
'0x2f956eee002b0debd468cf2e0490d1aec65e027f': {
|
|
@@ -68,6 +70,38 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
68
70
|
address: '0x2eb24483ef551da247ab87cf18e1cc980073032d',
|
|
69
71
|
basePoolAddress: '0xDcEF968d416a41Cdac0ED8702fAC8128A64241A2',
|
|
70
72
|
},
|
|
73
|
+
'0x008cfa89df5b0c780ca3462fc2602d7f8c7ac315': {
|
|
74
|
+
name: ImplementationNames.FACTORY_META_BTC_SBTC2,
|
|
75
|
+
address: '0x008cfa89df5b0c780ca3462fc2602d7f8c7ac315',
|
|
76
|
+
basePoolAddress: '0xf253f83AcA21aAbD2A20553AE0BF7F65C755A07F',
|
|
77
|
+
},
|
|
78
|
+
'0xabc533ebcdded41215c46ee078c5818b5b0a252f': {
|
|
79
|
+
name: ImplementationNames.FACTORY_META_BTC_BALANCES_SBTC2,
|
|
80
|
+
address: '0xabc533ebcdded41215c46ee078c5818b5b0a252f',
|
|
81
|
+
basePoolAddress: '0xf253f83AcA21aAbD2A20553AE0BF7F65C755A07F',
|
|
82
|
+
},
|
|
83
|
+
'0xc629a01ec23ab04e1050500a3717a2a5c0701497': {
|
|
84
|
+
name: ImplementationNames.FACTORY_PLAIN_2_BASIC_EMA,
|
|
85
|
+
address: '0xc629a01ec23ab04e1050500a3717a2a5c0701497',
|
|
86
|
+
customGasCost: 130_000,
|
|
87
|
+
},
|
|
88
|
+
'0x94b4dfd9ba5865cc931195c99a2db42f3fc5d45b': {
|
|
89
|
+
name: ImplementationNames.FACTORY_PLAIN_2_ETH_EMA,
|
|
90
|
+
address: '0x94b4dfd9ba5865cc931195c99a2db42f3fc5d45b',
|
|
91
|
+
customGasCost: 130_000,
|
|
92
|
+
},
|
|
93
|
+
'0x847ee1227a9900b73aeeb3a47fac92c52fd54ed9': {
|
|
94
|
+
name: ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2,
|
|
95
|
+
address: '0x847ee1227a9900b73aeeb3a47fac92c52fd54ed9',
|
|
96
|
+
customGasCost: 130_000,
|
|
97
|
+
isStoreRateSupported: true,
|
|
98
|
+
},
|
|
99
|
+
'0x1713141278648a4edd5b027fdbd448bb4a13ac0f': {
|
|
100
|
+
name: ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2,
|
|
101
|
+
address: '0x1713141278648a4edd5b027fdbd448bb4a13ac0f',
|
|
102
|
+
customGasCost: 130_000,
|
|
103
|
+
isStoreRateSupported: true,
|
|
104
|
+
},
|
|
71
105
|
'0x24d937143d3f5cf04c72ba112735151a8cae2262': {
|
|
72
106
|
name: ImplementationNames.FACTORY_PLAIN_2_BALANCES,
|
|
73
107
|
address: '0x24d937143d3f5cf04c72ba112735151a8cae2262',
|
|
@@ -125,6 +159,7 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
125
159
|
liquidityApiSlug: '/main',
|
|
126
160
|
coinsInputType: 'uint256',
|
|
127
161
|
balancesInputType: 'uint256',
|
|
162
|
+
useForPricing: false,
|
|
128
163
|
},
|
|
129
164
|
'0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714': {
|
|
130
165
|
name: CustomImplementationNames.CUSTOM_PLAIN_3COIN_SBTC,
|
|
@@ -133,6 +168,7 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
133
168
|
liquidityApiSlug: '/main',
|
|
134
169
|
coinsInputType: 'int128',
|
|
135
170
|
balancesInputType: 'int128',
|
|
171
|
+
useForPricing: false,
|
|
136
172
|
},
|
|
137
173
|
'0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7': {
|
|
138
174
|
name: CustomImplementationNames.CUSTOM_PLAIN_3COIN_THREE,
|
|
@@ -141,6 +177,7 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
141
177
|
liquidityApiSlug: '/main',
|
|
142
178
|
coinsInputType: 'uint256',
|
|
143
179
|
balancesInputType: 'uint256',
|
|
180
|
+
useForPricing: false,
|
|
144
181
|
},
|
|
145
182
|
'0x93054188d876f558f4a66B2EF1d97d16eDf0895B': {
|
|
146
183
|
name: CustomImplementationNames.CUSTOM_PLAIN_2COIN_RENBTC,
|
|
@@ -149,6 +186,16 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
149
186
|
liquidityApiSlug: '/main',
|
|
150
187
|
coinsInputType: 'int128',
|
|
151
188
|
balancesInputType: 'int128',
|
|
189
|
+
useForPricing: false,
|
|
190
|
+
},
|
|
191
|
+
'0xf253f83aca21aabd2a20553ae0bf7f65c755a07f': {
|
|
192
|
+
name: CustomImplementationNames.CUSTOM_PLAIN_2COIN_WBTC,
|
|
193
|
+
address: '0xf253f83aca21aabd2a20553ae0bf7f65c755a07f',
|
|
194
|
+
lpTokenAddress: '0x051d7e5609917Bd9b73f04BAc0DED8Dd46a74301',
|
|
195
|
+
liquidityApiSlug: '/main',
|
|
196
|
+
coinsInputType: 'uint256',
|
|
197
|
+
balancesInputType: 'uint256',
|
|
198
|
+
useForPricing: true,
|
|
152
199
|
},
|
|
153
200
|
},
|
|
154
201
|
},
|
|
@@ -245,6 +292,7 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
245
292
|
liquidityApiSlug: '/main',
|
|
246
293
|
coinsInputType: 'uint256',
|
|
247
294
|
balancesInputType: 'uint256',
|
|
295
|
+
useForPricing: false,
|
|
248
296
|
},
|
|
249
297
|
'0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67': {
|
|
250
298
|
name: CustomImplementationNames.CUSTOM_POLYGON_2COIN_LENDING,
|
|
@@ -253,6 +301,7 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
253
301
|
liquidityApiSlug: '/main',
|
|
254
302
|
coinsInputType: 'uint256',
|
|
255
303
|
balancesInputType: 'uint256',
|
|
304
|
+
useForPricing: false,
|
|
256
305
|
},
|
|
257
306
|
},
|
|
258
307
|
},
|
|
@@ -349,6 +398,7 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
349
398
|
liquidityApiSlug: '/main',
|
|
350
399
|
coinsInputType: 'uint256',
|
|
351
400
|
balancesInputType: 'uint256',
|
|
401
|
+
useForPricing: false,
|
|
352
402
|
},
|
|
353
403
|
'0x3eF6A01A0f81D6046290f3e2A8c5b843e738E604': {
|
|
354
404
|
name: CustomImplementationNames.CUSTOM_FANTOM_2COIN_BTC,
|
|
@@ -357,15 +407,17 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
357
407
|
liquidityApiSlug: '/main',
|
|
358
408
|
coinsInputType: 'uint256',
|
|
359
409
|
balancesInputType: 'uint256',
|
|
410
|
+
useForPricing: false,
|
|
411
|
+
},
|
|
412
|
+
'0x0fa949783947Bf6c1b171DB13AEACBB488845B3f': {
|
|
413
|
+
name: CustomImplementationNames.CUSTOM_FANTOM_3COIN_LENDING,
|
|
414
|
+
address: '0x0fa949783947Bf6c1b171DB13AEACBB488845B3f',
|
|
415
|
+
lpTokenAddress: '0xD02a30d33153877BC20e5721ee53DeDEE0422B2F',
|
|
416
|
+
liquidityApiSlug: '/main',
|
|
417
|
+
coinsInputType: 'uint256',
|
|
418
|
+
balancesInputType: 'uint256',
|
|
419
|
+
useForPricing: false,
|
|
360
420
|
},
|
|
361
|
-
// '0x0fa949783947Bf6c1b171DB13AEACBB488845B3f': {
|
|
362
|
-
// name: CustomImplementationNames.CUSTOM_FANTOM_3COIN_LENDING,
|
|
363
|
-
// address: '0x0fa949783947Bf6c1b171DB13AEACBB488845B3f',
|
|
364
|
-
// lpTokenAddress: '0xD02a30d33153877BC20e5721ee53DeDEE0422B2F',
|
|
365
|
-
// liquidityApiSlug: '/main',
|
|
366
|
-
// coinsInputType: 'uint256',
|
|
367
|
-
// balancesInputType: 'uint256',
|
|
368
|
-
// },
|
|
369
421
|
},
|
|
370
422
|
},
|
|
371
423
|
[Network.AVALANCHE]: {
|
|
@@ -454,6 +506,7 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
454
506
|
liquidityApiSlug: '/main',
|
|
455
507
|
coinsInputType: 'uint256',
|
|
456
508
|
balancesInputType: 'uint256',
|
|
509
|
+
useForPricing: false,
|
|
457
510
|
},
|
|
458
511
|
// This contract is not verified. I think it is just abandoned. I am commenting both related
|
|
459
512
|
// btc meta pools
|
|
@@ -549,6 +602,17 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
549
602
|
address: '0xF1f85a74AD6c64315F85af52d3d46bF715236ADc',
|
|
550
603
|
basePoolAddress: '0x3E01dD8a5E1fb3481F0F589056b428Fc308AF0Fb',
|
|
551
604
|
},
|
|
605
|
+
'0x73ec37618683c274d0bbf5f5726aa856b2bdab81': {
|
|
606
|
+
name: ImplementationNames.FACTORY_PLAIN_2_BASIC_EMA,
|
|
607
|
+
address: '0x73ec37618683c274d0bbf5f5726aa856b2bdab81',
|
|
608
|
+
customGasCost: 130_000,
|
|
609
|
+
},
|
|
610
|
+
'0x6f9fb833501f46cbe6f6a4b6cf32c834e5a5e8c5': {
|
|
611
|
+
name: ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2,
|
|
612
|
+
address: '0x6f9fb833501f46cbe6f6a4b6cf32c834e5a5e8c5',
|
|
613
|
+
customGasCost: 130_000,
|
|
614
|
+
isStoreRateSupported: true,
|
|
615
|
+
},
|
|
552
616
|
},
|
|
553
617
|
customPools: {
|
|
554
618
|
'0x7f90122BF0700F9E7e1F688fe926940E8839F353': {
|
|
@@ -558,6 +622,7 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
558
622
|
liquidityApiSlug: '/main',
|
|
559
623
|
coinsInputType: 'uint256',
|
|
560
624
|
balancesInputType: 'uint256',
|
|
625
|
+
useForPricing: false,
|
|
561
626
|
},
|
|
562
627
|
'0xC9B8a3FDECB9D5b218d02555a8Baf332E5B740d5': {
|
|
563
628
|
name: FactoryImplementationNames.FACTORY_PLAIN_2_BASIC,
|
|
@@ -566,6 +631,7 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
566
631
|
liquidityApiSlug: '/factory',
|
|
567
632
|
coinsInputType: 'uint256',
|
|
568
633
|
balancesInputType: 'uint256',
|
|
634
|
+
useForPricing: false,
|
|
569
635
|
},
|
|
570
636
|
'0x3E01dD8a5E1fb3481F0F589056b428Fc308AF0Fb': {
|
|
571
637
|
name: CustomImplementationNames.CUSTOM_ARBITRUM_2COIN_BTC,
|
|
@@ -574,6 +640,7 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
574
640
|
liquidityApiSlug: '/main',
|
|
575
641
|
coinsInputType: 'uint256',
|
|
576
642
|
balancesInputType: 'uint256',
|
|
643
|
+
useForPricing: false,
|
|
577
644
|
},
|
|
578
645
|
},
|
|
579
646
|
},
|
|
@@ -651,6 +718,17 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
651
718
|
address: '0x114C4042B11a2b16F58Fe1BFe847589a122F678a',
|
|
652
719
|
basePoolAddress: '0x29A3d66B30Bc4AD674A4FDAF27578B64f6afbFe7',
|
|
653
720
|
},
|
|
721
|
+
'0x73ec37618683c274d0bbf5f5726aa856b2bdab81': {
|
|
722
|
+
name: ImplementationNames.FACTORY_PLAIN_2_BASIC_EMA,
|
|
723
|
+
address: '0x73ec37618683c274d0bbf5f5726aa856b2bdab81',
|
|
724
|
+
customGasCost: 130_000,
|
|
725
|
+
},
|
|
726
|
+
'0x6f9fb833501f46cbe6f6a4b6cf32c834e5a5e8c5': {
|
|
727
|
+
name: ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2,
|
|
728
|
+
address: '0x6f9fb833501f46cbe6f6a4b6cf32c834e5a5e8c5',
|
|
729
|
+
customGasCost: 130_000,
|
|
730
|
+
isStoreRateSupported: true,
|
|
731
|
+
},
|
|
654
732
|
},
|
|
655
733
|
customPools: {
|
|
656
734
|
'0x1337BedC9D22ecbe766dF105c9623922A27963EC': {
|
|
@@ -660,6 +738,7 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
660
738
|
liquidityApiSlug: '/main',
|
|
661
739
|
coinsInputType: 'uint256',
|
|
662
740
|
balancesInputType: 'uint256',
|
|
741
|
+
useForPricing: false,
|
|
663
742
|
},
|
|
664
743
|
'0x29A3d66B30Bc4AD674A4FDAF27578B64f6afbFe7': {
|
|
665
744
|
name: FactoryImplementationNames.FACTORY_PLAIN_2_BASIC,
|
|
@@ -668,6 +747,7 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
668
747
|
liquidityApiSlug: '/factory',
|
|
669
748
|
coinsInputType: 'uint256',
|
|
670
749
|
balancesInputType: 'uint256',
|
|
750
|
+
useForPricing: false,
|
|
671
751
|
},
|
|
672
752
|
},
|
|
673
753
|
},
|
|
@@ -761,6 +841,7 @@ const configAddressesNormalizer = (
|
|
|
761
841
|
balancesInputType: customPoolConfig.balancesInputType,
|
|
762
842
|
address: normalizeAddress(customPoolConfig.address),
|
|
763
843
|
lpTokenAddress: normalizeAddress(customPoolConfig.lpTokenAddress),
|
|
844
|
+
useForPricing: customPoolConfig.useForPricing,
|
|
764
845
|
};
|
|
765
846
|
acc[normalizeAddress(customPoolAddress)] = normalizedImplementation;
|
|
766
847
|
return acc;
|
|
@@ -777,6 +858,7 @@ const configAddressesNormalizer = (
|
|
|
777
858
|
basePoolAddress: implementationConfig.basePoolAddress
|
|
778
859
|
? normalizeAddress(implementationConfig.basePoolAddress)
|
|
779
860
|
: undefined,
|
|
861
|
+
isStoreRateSupported: implementationConfig.isStoreRateSupported,
|
|
780
862
|
};
|
|
781
863
|
acc[normalizeAddress(implementationAddress)] =
|
|
782
864
|
normalizedImplementation;
|
|
@@ -111,6 +111,42 @@ describe('CurveV1Factory E2E', () => {
|
|
|
111
111
|
tokenBAmount,
|
|
112
112
|
);
|
|
113
113
|
});
|
|
114
|
+
describe('Mainnet ng pool', () => {
|
|
115
|
+
const network = Network.MAINNET;
|
|
116
|
+
|
|
117
|
+
const tokenASymbol: string = 'ETH';
|
|
118
|
+
const tokenBSymbol: string = 'STETH';
|
|
119
|
+
|
|
120
|
+
const tokenAAmount: string = '1000000000000000000';
|
|
121
|
+
const tokenBAmount: string = '1000000000000000000';
|
|
122
|
+
|
|
123
|
+
testForNetwork(
|
|
124
|
+
network,
|
|
125
|
+
dexKey,
|
|
126
|
+
tokenASymbol,
|
|
127
|
+
tokenBSymbol,
|
|
128
|
+
tokenAAmount,
|
|
129
|
+
tokenBAmount,
|
|
130
|
+
);
|
|
131
|
+
});
|
|
132
|
+
describe('Mainnet SBTC2 pool', () => {
|
|
133
|
+
const network = Network.MAINNET;
|
|
134
|
+
|
|
135
|
+
const tokenASymbol: string = 'WBTC';
|
|
136
|
+
const tokenBSymbol: string = 'sBTC';
|
|
137
|
+
|
|
138
|
+
const tokenAAmount: string = '100000000';
|
|
139
|
+
const tokenBAmount: string = '1000000000000000000';
|
|
140
|
+
|
|
141
|
+
testForNetwork(
|
|
142
|
+
network,
|
|
143
|
+
dexKey,
|
|
144
|
+
tokenASymbol,
|
|
145
|
+
tokenBSymbol,
|
|
146
|
+
tokenAAmount,
|
|
147
|
+
tokenBAmount,
|
|
148
|
+
);
|
|
149
|
+
});
|
|
114
150
|
describe('Polygon', () => {
|
|
115
151
|
const network = Network.POLYGON;
|
|
116
152
|
|
|
@@ -160,6 +160,14 @@ export class CurveV1Factory
|
|
|
160
160
|
return acc;
|
|
161
161
|
}, {});
|
|
162
162
|
|
|
163
|
+
Object.values(this.config.customPools).reduce((acc, curr) => {
|
|
164
|
+
if (curr.useForPricing) {
|
|
165
|
+
acc[curr.address] = new PriceHandler(this.logger, curr.name);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return acc;
|
|
169
|
+
}, allPriceHandlers);
|
|
170
|
+
|
|
163
171
|
this.poolManager = new CurveV1FactoryPoolManager(
|
|
164
172
|
this.dexKey,
|
|
165
173
|
dexHelper.getLogger(`${this.dexKey}-state-manager`),
|
|
@@ -256,7 +264,7 @@ export class CurveV1Factory
|
|
|
256
264
|
CustomImplementationNames,
|
|
257
265
|
).includes(customPool.name)
|
|
258
266
|
) {
|
|
259
|
-
// We don't want custom pools to be used for pricing
|
|
267
|
+
// We don't want custom pools to be used for pricing, unless explicitly specified
|
|
260
268
|
newPool = new CustomBasePoolForFactory(
|
|
261
269
|
this.logger,
|
|
262
270
|
this.dexKey,
|
|
@@ -274,6 +282,7 @@ export class CurveV1Factory
|
|
|
274
282
|
isLending,
|
|
275
283
|
customPool.balancesInputType,
|
|
276
284
|
useLending,
|
|
285
|
+
customPool.useForPricing,
|
|
277
286
|
);
|
|
278
287
|
} else {
|
|
279
288
|
// Use for pricing pools from factory
|
|
@@ -580,6 +589,8 @@ export class CurveV1Factory
|
|
|
580
589
|
factoryImplementationConstants,
|
|
581
590
|
factoryImplementationConstants.isFeeOnTransferSupported,
|
|
582
591
|
basePoolStateFetcher,
|
|
592
|
+
factoryImplementationFromConfig.customGasCost,
|
|
593
|
+
factoryImplementationFromConfig.isStoreRateSupported,
|
|
583
594
|
);
|
|
584
595
|
|
|
585
596
|
this.poolManager.initializeNewPool(poolIdentifier, newPool);
|
|
@@ -16,6 +16,7 @@ import { PoolPollingBase } from './state-polling-pools/pool-polling-base';
|
|
|
16
16
|
import { StatePollingManager } from './state-polling-pools/polling-manager';
|
|
17
17
|
import { CACHE_PREFIX, NULL_ADDRESS } from '../../constants';
|
|
18
18
|
import { LiquidityInCache } from './types';
|
|
19
|
+
import { assert } from 'ts-essentials';
|
|
19
20
|
|
|
20
21
|
/*
|
|
21
22
|
* The idea of FactoryPoolManager is to try to abstract both pool types: fully event based
|
|
@@ -123,6 +124,11 @@ export class CurveV1FactoryPoolManager {
|
|
|
123
124
|
}
|
|
124
125
|
|
|
125
126
|
getPriceHandler(implementationAddress: string): PriceHandler {
|
|
127
|
+
assert(
|
|
128
|
+
this.allPriceHandlers[implementationAddress],
|
|
129
|
+
`No price handler for ${implementationAddress}`,
|
|
130
|
+
);
|
|
131
|
+
|
|
126
132
|
return this.allPriceHandlers[implementationAddress];
|
|
127
133
|
}
|
|
128
134
|
|
|
@@ -52,22 +52,21 @@ const customPlain3CoinThree: _calc_withdraw_one_coin = (
|
|
|
52
52
|
return [dy, dy_0 - dy, undefined];
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
const
|
|
55
|
+
const _genericCustomArbitrum2CoinBtc = (
|
|
56
56
|
self: IPoolContext,
|
|
57
57
|
state: PoolState,
|
|
58
58
|
_token_amount: bigint,
|
|
59
59
|
i: number,
|
|
60
|
-
|
|
60
|
+
rates: bigint[],
|
|
61
|
+
): [bigint, bigint, undefined] => {
|
|
61
62
|
const { N_COINS, BI_N_COINS, FEE_DENOMINATOR, PRECISION } = self.constants;
|
|
63
|
+
|
|
62
64
|
if (state.totalSupply === undefined) {
|
|
63
65
|
throw new Error(
|
|
64
|
-
`${self.IMPLEMENTATION_NAME}
|
|
66
|
+
`${self.IMPLEMENTATION_NAME} _genericCustomArbitrum2CoinBtc: totalSupply is not provided`,
|
|
65
67
|
);
|
|
66
68
|
}
|
|
67
|
-
|
|
68
69
|
const amp = state.A;
|
|
69
|
-
const rates = [...state.constants.rate_multipliers];
|
|
70
|
-
|
|
71
70
|
const xp = self._xp_mem(self, rates, state.balances);
|
|
72
71
|
const D0 = self.get_D(self, xp, amp);
|
|
73
72
|
|
|
@@ -96,6 +95,46 @@ const customArbitrum2CoinBtc: _calc_withdraw_one_coin = (
|
|
|
96
95
|
return [dy, dy_0 - dy, undefined];
|
|
97
96
|
};
|
|
98
97
|
|
|
98
|
+
const customArbitrum2CoinBtc: _calc_withdraw_one_coin = (
|
|
99
|
+
self: IPoolContext,
|
|
100
|
+
state: PoolState,
|
|
101
|
+
_token_amount: bigint,
|
|
102
|
+
i: number,
|
|
103
|
+
) => {
|
|
104
|
+
const rates = [...state.constants.rate_multipliers];
|
|
105
|
+
return _genericCustomArbitrum2CoinBtc(self, state, _token_amount, i, rates);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const factoryPlain2EthEma2: _calc_withdraw_one_coin = (
|
|
109
|
+
self: IPoolContext,
|
|
110
|
+
state: PoolState,
|
|
111
|
+
_token_amount: bigint,
|
|
112
|
+
i: number,
|
|
113
|
+
) => {
|
|
114
|
+
if (state.storedRates === undefined) {
|
|
115
|
+
throw new Error(
|
|
116
|
+
`${self.IMPLEMENTATION_NAME} factoryPlain2EthEma2: storedRates is not provided`,
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
const rates = [...state.storedRates];
|
|
120
|
+
return _genericCustomArbitrum2CoinBtc(self, state, _token_amount, i, rates);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const factoryMetaBtcSbtc2: _calc_withdraw_one_coin = (
|
|
124
|
+
self: IPoolContext,
|
|
125
|
+
state: PoolState,
|
|
126
|
+
_token_amount: bigint,
|
|
127
|
+
i: number,
|
|
128
|
+
) => {
|
|
129
|
+
if (state.virtualPrice === undefined) {
|
|
130
|
+
throw new Error(
|
|
131
|
+
`${self.IMPLEMENTATION_NAME} factoryMetaBtcSbtc2: virtualPrice is not provided`,
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
const rates = [state.constants.rate_multipliers[0], state.virtualPrice];
|
|
135
|
+
return _genericCustomArbitrum2CoinBtc(self, state, _token_amount, i, rates);
|
|
136
|
+
};
|
|
137
|
+
|
|
99
138
|
const customAvalanche3CoinLending: _calc_withdraw_one_coin = (
|
|
100
139
|
self: IPoolContext,
|
|
101
140
|
state: PoolState,
|
|
@@ -187,6 +226,7 @@ const notImplemented: _calc_withdraw_one_coin = (
|
|
|
187
226
|
const implementations: Record<ImplementationNames, _calc_withdraw_one_coin> = {
|
|
188
227
|
[ImplementationNames.CUSTOM_PLAIN_2COIN_FRAX]: customPlain3CoinThree,
|
|
189
228
|
[ImplementationNames.CUSTOM_PLAIN_2COIN_RENBTC]: customPlain3CoinThree,
|
|
229
|
+
[ImplementationNames.CUSTOM_PLAIN_2COIN_WBTC]: customFantom2CoinBtc,
|
|
190
230
|
[ImplementationNames.CUSTOM_PLAIN_3COIN_SBTC]: customPlain3CoinThree,
|
|
191
231
|
[ImplementationNames.CUSTOM_PLAIN_3COIN_THREE]: customPlain3CoinThree,
|
|
192
232
|
|
|
@@ -237,6 +277,13 @@ const implementations: Record<ImplementationNames, _calc_withdraw_one_coin> = {
|
|
|
237
277
|
[ImplementationNames.FACTORY_PLAIN_4_BASIC]: notImplemented,
|
|
238
278
|
[ImplementationNames.FACTORY_PLAIN_4_ETH]: notImplemented,
|
|
239
279
|
[ImplementationNames.FACTORY_PLAIN_4_OPTIMIZED]: notImplemented,
|
|
280
|
+
|
|
281
|
+
[ImplementationNames.FACTORY_META_BTC_SBTC2]: factoryMetaBtcSbtc2,
|
|
282
|
+
[ImplementationNames.FACTORY_META_BTC_BALANCES_SBTC2]: factoryMetaBtcSbtc2,
|
|
283
|
+
// Keep in mind: these 2 are not 100% correct, because I don't calculate last "last_p" entry, because it doesn't affect pricing
|
|
284
|
+
[ImplementationNames.FACTORY_PLAIN_2_BASIC_EMA]: customArbitrum2CoinBtc,
|
|
285
|
+
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA]: customArbitrum2CoinBtc,
|
|
286
|
+
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2]: factoryPlain2EthEma2,
|
|
240
287
|
};
|
|
241
288
|
|
|
242
289
|
export default implementations;
|
|
@@ -36,6 +36,7 @@ const notExist: _dynamic_fee = (
|
|
|
36
36
|
const implementations: Record<ImplementationNames, _dynamic_fee> = {
|
|
37
37
|
[ImplementationNames.CUSTOM_PLAIN_2COIN_FRAX]: notExist,
|
|
38
38
|
[ImplementationNames.CUSTOM_PLAIN_2COIN_RENBTC]: notExist,
|
|
39
|
+
[ImplementationNames.CUSTOM_PLAIN_2COIN_WBTC]: notExist,
|
|
39
40
|
[ImplementationNames.CUSTOM_PLAIN_3COIN_SBTC]: notExist,
|
|
40
41
|
[ImplementationNames.CUSTOM_PLAIN_3COIN_THREE]: notExist,
|
|
41
42
|
|
|
@@ -86,6 +87,12 @@ const implementations: Record<ImplementationNames, _dynamic_fee> = {
|
|
|
86
87
|
[ImplementationNames.FACTORY_PLAIN_4_BASIC]: notExist,
|
|
87
88
|
[ImplementationNames.FACTORY_PLAIN_4_ETH]: notExist,
|
|
88
89
|
[ImplementationNames.FACTORY_PLAIN_4_OPTIMIZED]: notExist,
|
|
90
|
+
|
|
91
|
+
[ImplementationNames.FACTORY_META_BTC_SBTC2]: notExist,
|
|
92
|
+
[ImplementationNames.FACTORY_META_BTC_BALANCES_SBTC2]: notExist,
|
|
93
|
+
[ImplementationNames.FACTORY_PLAIN_2_BASIC_EMA]: notExist,
|
|
94
|
+
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA]: notExist,
|
|
95
|
+
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2]: notExist,
|
|
89
96
|
};
|
|
90
97
|
|
|
91
98
|
export default implementations;
|
|
@@ -55,6 +55,7 @@ const notExist: _rates = (self: IPoolContext, state: PoolState) => {
|
|
|
55
55
|
const implementations: Record<ImplementationNames, _rates> = {
|
|
56
56
|
[ImplementationNames.CUSTOM_PLAIN_2COIN_FRAX]: notExist,
|
|
57
57
|
[ImplementationNames.CUSTOM_PLAIN_2COIN_RENBTC]: customPlain3CoinSbtc,
|
|
58
|
+
[ImplementationNames.CUSTOM_PLAIN_2COIN_WBTC]: notExist,
|
|
58
59
|
[ImplementationNames.CUSTOM_PLAIN_3COIN_SBTC]: customPlain3CoinSbtc,
|
|
59
60
|
[ImplementationNames.CUSTOM_PLAIN_3COIN_THREE]: notExist,
|
|
60
61
|
|
|
@@ -101,6 +102,12 @@ const implementations: Record<ImplementationNames, _rates> = {
|
|
|
101
102
|
[ImplementationNames.FACTORY_PLAIN_4_BASIC]: notExist,
|
|
102
103
|
[ImplementationNames.FACTORY_PLAIN_4_ETH]: notExist,
|
|
103
104
|
[ImplementationNames.FACTORY_PLAIN_4_OPTIMIZED]: notExist,
|
|
105
|
+
|
|
106
|
+
[ImplementationNames.FACTORY_META_BTC_SBTC2]: notExist,
|
|
107
|
+
[ImplementationNames.FACTORY_META_BTC_BALANCES_SBTC2]: notExist,
|
|
108
|
+
[ImplementationNames.FACTORY_PLAIN_2_BASIC_EMA]: notExist,
|
|
109
|
+
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA]: notExist,
|
|
110
|
+
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2]: notExist,
|
|
104
111
|
};
|
|
105
112
|
|
|
106
113
|
export default implementations;
|
|
@@ -53,6 +53,7 @@ const notExist: _xp = (self: IPoolContext, state: PoolState) => {
|
|
|
53
53
|
const implementations: Record<ImplementationNames, _xp> = {
|
|
54
54
|
[ImplementationNames.CUSTOM_PLAIN_2COIN_FRAX]: customPlain2CoinFrax,
|
|
55
55
|
[ImplementationNames.CUSTOM_PLAIN_2COIN_RENBTC]: customPlain3CoinSbtc,
|
|
56
|
+
[ImplementationNames.CUSTOM_PLAIN_2COIN_WBTC]: customPlain2CoinFrax,
|
|
56
57
|
[ImplementationNames.CUSTOM_PLAIN_3COIN_SBTC]: customPlain3CoinSbtc,
|
|
57
58
|
[ImplementationNames.CUSTOM_PLAIN_3COIN_THREE]: customPlain3CoinThree,
|
|
58
59
|
|
|
@@ -99,6 +100,12 @@ const implementations: Record<ImplementationNames, _xp> = {
|
|
|
99
100
|
[ImplementationNames.FACTORY_PLAIN_4_BASIC]: notExist,
|
|
100
101
|
[ImplementationNames.FACTORY_PLAIN_4_ETH]: notExist,
|
|
101
102
|
[ImplementationNames.FACTORY_PLAIN_4_OPTIMIZED]: notExist,
|
|
103
|
+
|
|
104
|
+
[ImplementationNames.FACTORY_META_BTC_SBTC2]: notExist,
|
|
105
|
+
[ImplementationNames.FACTORY_META_BTC_BALANCES_SBTC2]: notExist,
|
|
106
|
+
[ImplementationNames.FACTORY_PLAIN_2_BASIC_EMA]: notExist,
|
|
107
|
+
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA]: notExist,
|
|
108
|
+
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2]: notExist,
|
|
102
109
|
};
|
|
103
110
|
|
|
104
111
|
export default implementations;
|
|
@@ -42,6 +42,7 @@ const notExist: _xp_mem = (
|
|
|
42
42
|
const implementations: Record<ImplementationNames, _xp_mem> = {
|
|
43
43
|
[ImplementationNames.CUSTOM_PLAIN_2COIN_FRAX]: customPlain3CoinThree,
|
|
44
44
|
[ImplementationNames.CUSTOM_PLAIN_2COIN_RENBTC]: factoryPlain2Basic,
|
|
45
|
+
[ImplementationNames.CUSTOM_PLAIN_2COIN_WBTC]: customPlain3CoinThree,
|
|
45
46
|
[ImplementationNames.CUSTOM_PLAIN_3COIN_SBTC]: factoryPlain2Basic,
|
|
46
47
|
[ImplementationNames.CUSTOM_PLAIN_3COIN_THREE]: customPlain3CoinThree,
|
|
47
48
|
|
|
@@ -88,6 +89,12 @@ const implementations: Record<ImplementationNames, _xp_mem> = {
|
|
|
88
89
|
[ImplementationNames.FACTORY_PLAIN_4_OPTIMIZED]: factoryPlain2Basic,
|
|
89
90
|
[ImplementationNames.FACTORY_PLAIN_4_BALANCES]: factoryPlain2Basic,
|
|
90
91
|
[ImplementationNames.FACTORY_PLAIN_4_ETH]: factoryPlain2Basic,
|
|
92
|
+
|
|
93
|
+
[ImplementationNames.FACTORY_META_BTC_SBTC2]: factoryPlain2Basic,
|
|
94
|
+
[ImplementationNames.FACTORY_META_BTC_BALANCES_SBTC2]: factoryPlain2Basic,
|
|
95
|
+
[ImplementationNames.FACTORY_PLAIN_2_BASIC_EMA]: factoryPlain2Basic,
|
|
96
|
+
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA]: factoryPlain2Basic,
|
|
97
|
+
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2]: factoryPlain2Basic,
|
|
91
98
|
};
|
|
92
99
|
|
|
93
100
|
export default implementations;
|
|
@@ -76,6 +76,7 @@ const notImplemented: calc_token_amount = (
|
|
|
76
76
|
const implementations: Record<ImplementationNames, calc_token_amount> = {
|
|
77
77
|
[ImplementationNames.CUSTOM_PLAIN_2COIN_FRAX]: customPlain3CoinThree,
|
|
78
78
|
[ImplementationNames.CUSTOM_PLAIN_2COIN_RENBTC]: customPlain3CoinThree,
|
|
79
|
+
[ImplementationNames.CUSTOM_PLAIN_2COIN_WBTC]: customPlain3CoinThree,
|
|
79
80
|
[ImplementationNames.CUSTOM_PLAIN_3COIN_SBTC]: customPlain3CoinThree,
|
|
80
81
|
[ImplementationNames.CUSTOM_PLAIN_3COIN_THREE]: customPlain3CoinThree,
|
|
81
82
|
|
|
@@ -126,6 +127,12 @@ const implementations: Record<ImplementationNames, calc_token_amount> = {
|
|
|
126
127
|
[ImplementationNames.FACTORY_PLAIN_4_BASIC]: notImplemented,
|
|
127
128
|
[ImplementationNames.FACTORY_PLAIN_4_ETH]: notImplemented,
|
|
128
129
|
[ImplementationNames.FACTORY_PLAIN_4_OPTIMIZED]: notImplemented,
|
|
130
|
+
|
|
131
|
+
[ImplementationNames.FACTORY_META_BTC_SBTC2]: customPlain3CoinThree,
|
|
132
|
+
[ImplementationNames.FACTORY_META_BTC_BALANCES_SBTC2]: customPlain3CoinThree,
|
|
133
|
+
[ImplementationNames.FACTORY_PLAIN_2_BASIC_EMA]: customPlain3CoinThree,
|
|
134
|
+
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA]: customPlain3CoinThree,
|
|
135
|
+
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2]: customPlain3CoinThree,
|
|
129
136
|
};
|
|
130
137
|
|
|
131
138
|
export default implementations;
|
|
@@ -29,6 +29,7 @@ export const implementations: Record<
|
|
|
29
29
|
> = {
|
|
30
30
|
[ImplementationNames.CUSTOM_PLAIN_2COIN_FRAX]: customPlain3CoinThree,
|
|
31
31
|
[ImplementationNames.CUSTOM_PLAIN_2COIN_RENBTC]: customPlain3CoinThree,
|
|
32
|
+
[ImplementationNames.CUSTOM_PLAIN_2COIN_WBTC]: customPlain3CoinThree,
|
|
32
33
|
[ImplementationNames.CUSTOM_PLAIN_3COIN_SBTC]: customPlain3CoinThree,
|
|
33
34
|
[ImplementationNames.CUSTOM_PLAIN_3COIN_THREE]: customPlain3CoinThree,
|
|
34
35
|
|
|
@@ -75,6 +76,12 @@ export const implementations: Record<
|
|
|
75
76
|
[ImplementationNames.FACTORY_PLAIN_4_BASIC]: notImplemented,
|
|
76
77
|
[ImplementationNames.FACTORY_PLAIN_4_ETH]: notImplemented,
|
|
77
78
|
[ImplementationNames.FACTORY_PLAIN_4_OPTIMIZED]: notImplemented,
|
|
79
|
+
|
|
80
|
+
[ImplementationNames.FACTORY_META_BTC_SBTC2]: customPlain3CoinThree,
|
|
81
|
+
[ImplementationNames.FACTORY_META_BTC_BALANCES_SBTC2]: customPlain3CoinThree,
|
|
82
|
+
[ImplementationNames.FACTORY_PLAIN_2_BASIC_EMA]: customPlain3CoinThree,
|
|
83
|
+
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA]: customPlain3CoinThree,
|
|
84
|
+
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2]: customPlain3CoinThree,
|
|
78
85
|
};
|
|
79
86
|
|
|
80
87
|
export default implementations;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {} from 'ts-essentials';
|
|
2
2
|
import { BI_POWS } from '../../../../bigint-constants';
|
|
3
|
+
import { PRECISION } from '../../../kyberdmm/fee-formula';
|
|
3
4
|
import { ImplementationNames, PoolContextConstants } from '../../types';
|
|
4
5
|
|
|
5
6
|
const implementationConstants: Record<
|
|
@@ -35,6 +36,21 @@ const implementationConstants: Record<
|
|
|
35
36
|
LENDING_PRECISION: BI_POWS[18],
|
|
36
37
|
USE_LENDING: [true, false],
|
|
37
38
|
},
|
|
39
|
+
[ImplementationNames.CUSTOM_PLAIN_2COIN_WBTC]: {
|
|
40
|
+
isWrapNative: false,
|
|
41
|
+
isFeeOnTransferSupported: false,
|
|
42
|
+
isLending: false,
|
|
43
|
+
|
|
44
|
+
N_COINS: 2,
|
|
45
|
+
BI_N_COINS: 2n,
|
|
46
|
+
|
|
47
|
+
FEE_DENOMINATOR: BI_POWS[10],
|
|
48
|
+
PRECISION: BI_POWS[18],
|
|
49
|
+
|
|
50
|
+
PRECISION_MUL: [10000000000n, 1n],
|
|
51
|
+
RATES: [10000000000000000000000000000n, 1000000000000000000n],
|
|
52
|
+
A_PRECISION: 100n,
|
|
53
|
+
},
|
|
38
54
|
[ImplementationNames.CUSTOM_PLAIN_3COIN_SBTC]: {
|
|
39
55
|
isWrapNative: false,
|
|
40
56
|
isFeeOnTransferSupported: false,
|
|
@@ -501,6 +517,68 @@ const implementationConstants: Record<
|
|
|
501
517
|
|
|
502
518
|
A_PRECISION: 100n,
|
|
503
519
|
},
|
|
520
|
+
|
|
521
|
+
[ImplementationNames.FACTORY_META_BTC_SBTC2]: {
|
|
522
|
+
isWrapNative: false,
|
|
523
|
+
isFeeOnTransferSupported: false,
|
|
524
|
+
isLending: false,
|
|
525
|
+
|
|
526
|
+
N_COINS: 2,
|
|
527
|
+
BI_N_COINS: 2n,
|
|
528
|
+
MAX_COIN: 2 - 1,
|
|
529
|
+
|
|
530
|
+
BASE_N_COINS: 2,
|
|
531
|
+
PRECISION: BI_POWS[18],
|
|
532
|
+
FEE_DENOMINATOR: BI_POWS[10],
|
|
533
|
+
A_PRECISION: 100n,
|
|
534
|
+
},
|
|
535
|
+
[ImplementationNames.FACTORY_META_BTC_BALANCES_SBTC2]: {
|
|
536
|
+
isWrapNative: false,
|
|
537
|
+
isFeeOnTransferSupported: true,
|
|
538
|
+
isLending: false,
|
|
539
|
+
|
|
540
|
+
N_COINS: 2,
|
|
541
|
+
BI_N_COINS: 2n,
|
|
542
|
+
MAX_COIN: 2 - 1,
|
|
543
|
+
|
|
544
|
+
BASE_N_COINS: 2,
|
|
545
|
+
PRECISION: BI_POWS[18],
|
|
546
|
+
FEE_DENOMINATOR: BI_POWS[10],
|
|
547
|
+
A_PRECISION: 100n,
|
|
548
|
+
},
|
|
549
|
+
[ImplementationNames.FACTORY_PLAIN_2_BASIC_EMA]: {
|
|
550
|
+
isWrapNative: false,
|
|
551
|
+
isFeeOnTransferSupported: false,
|
|
552
|
+
isLending: false,
|
|
553
|
+
|
|
554
|
+
N_COINS: 2,
|
|
555
|
+
BI_N_COINS: 2n,
|
|
556
|
+
PRECISION: BI_POWS[18],
|
|
557
|
+
FEE_DENOMINATOR: BI_POWS[10],
|
|
558
|
+
A_PRECISION: 100n,
|
|
559
|
+
},
|
|
560
|
+
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA]: {
|
|
561
|
+
isWrapNative: false,
|
|
562
|
+
isFeeOnTransferSupported: false,
|
|
563
|
+
isLending: false,
|
|
564
|
+
|
|
565
|
+
N_COINS: 2,
|
|
566
|
+
BI_N_COINS: 2n,
|
|
567
|
+
PRECISION: BI_POWS[18],
|
|
568
|
+
FEE_DENOMINATOR: BI_POWS[10],
|
|
569
|
+
A_PRECISION: 100n,
|
|
570
|
+
},
|
|
571
|
+
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2]: {
|
|
572
|
+
isWrapNative: false,
|
|
573
|
+
isFeeOnTransferSupported: true,
|
|
574
|
+
isLending: false,
|
|
575
|
+
|
|
576
|
+
N_COINS: 2,
|
|
577
|
+
BI_N_COINS: 2n,
|
|
578
|
+
PRECISION: BI_POWS[18],
|
|
579
|
+
FEE_DENOMINATOR: BI_POWS[10],
|
|
580
|
+
A_PRECISION: 100n,
|
|
581
|
+
},
|
|
504
582
|
};
|
|
505
583
|
|
|
506
584
|
export default implementationConstants;
|