@paraswap/dex-lib 3.8.33 → 3.8.34-inception
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/aave-gsm/aave-gsm.d.ts +0 -1
- package/build/dex/aave-gsm/aave-gsm.js +0 -4
- package/build/dex/aave-gsm/aave-gsm.js.map +1 -1
- package/build/dex/index.js +2 -0
- package/build/dex/index.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/inception/inception-ineth-pool.json +1062 -0
- package/src/abi/inception/inception-ratio-feed.json +329 -0
- package/src/abi/inception/inception-vault.json +991 -0
- package/src/dex/aave-gsm/aave-gsm.ts +0 -5
- package/src/dex/inception/config.ts +109 -0
- package/src/dex/inception/inception-e2e.test.ts +67 -0
- package/src/dex/inception/inception-event-pool.ts +62 -0
- package/src/dex/inception/inception-events.test.ts +64 -0
- package/src/dex/inception/inception-integration.test.ts +76 -0
- package/src/dex/inception/inception.ts +271 -0
- package/src/dex/inception/tokens.ts +37 -0
- package/src/dex/inception/types.ts +26 -0
- package/src/dex/inception/utils.ts +71 -0
- package/src/dex/index.ts +2 -0
- package/tests/constants-e2e.ts +106 -7
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type PoolState = {
|
|
2
|
+
[symbol: string]: {
|
|
3
|
+
ratio: bigint;
|
|
4
|
+
};
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type PoolConfig = {
|
|
8
|
+
ratioFeedAddress: string;
|
|
9
|
+
initState: PoolState;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type InceptionDexData = {
|
|
13
|
+
exchange: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type DexParams = {
|
|
17
|
+
symbol: string;
|
|
18
|
+
vault: string;
|
|
19
|
+
token: string;
|
|
20
|
+
baseToken: string;
|
|
21
|
+
baseTokenSlug: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type PricePoolParams = {
|
|
25
|
+
ratioFeed: string;
|
|
26
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Contract } from 'web3-eth-contract';
|
|
2
|
+
import { DexParams, PoolState } from './types';
|
|
3
|
+
import { AbiCoder, Interface } from '@ethersproject/abi';
|
|
4
|
+
import { InceptionConfig } from './config';
|
|
5
|
+
import { Network } from '../../constants';
|
|
6
|
+
|
|
7
|
+
const coder = new AbiCoder();
|
|
8
|
+
|
|
9
|
+
export async function getOnChainRatio(
|
|
10
|
+
multiContract: Contract,
|
|
11
|
+
poolInterface: Interface,
|
|
12
|
+
network: Network,
|
|
13
|
+
p: DexParams,
|
|
14
|
+
blockNumber: number | 'latest',
|
|
15
|
+
): Promise<bigint> {
|
|
16
|
+
let addr;
|
|
17
|
+
if (p.baseTokenSlug === 'ETH') {
|
|
18
|
+
addr = p.token;
|
|
19
|
+
} else {
|
|
20
|
+
addr = p.vault;
|
|
21
|
+
}
|
|
22
|
+
const data: { returnData: any[] } = await multiContract.methods
|
|
23
|
+
.aggregate([
|
|
24
|
+
{
|
|
25
|
+
target: addr,
|
|
26
|
+
callData: poolInterface.encodeFunctionData('ratio', []),
|
|
27
|
+
},
|
|
28
|
+
])
|
|
29
|
+
.call({}, blockNumber);
|
|
30
|
+
|
|
31
|
+
const decodedData = coder.decode(['uint256'], data.returnData[0]);
|
|
32
|
+
const ratio = BigInt(decodedData[0].toString());
|
|
33
|
+
return ratio;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export async function getOnChainState(
|
|
37
|
+
multiContract: Contract,
|
|
38
|
+
poolInterface: Interface,
|
|
39
|
+
network: Network,
|
|
40
|
+
blockNumber: number | 'latest',
|
|
41
|
+
): Promise<PoolState> {
|
|
42
|
+
let tokenList = await getTokenList(network);
|
|
43
|
+
const state: PoolState = {};
|
|
44
|
+
for (const p of tokenList) {
|
|
45
|
+
let addr;
|
|
46
|
+
if (p.baseTokenSlug === 'ETH') {
|
|
47
|
+
addr = p.token;
|
|
48
|
+
} else {
|
|
49
|
+
addr = p.vault;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const data = await multiContract.methods
|
|
53
|
+
.aggregate([
|
|
54
|
+
{
|
|
55
|
+
target: addr,
|
|
56
|
+
callData: poolInterface.encodeFunctionData('ratio', []),
|
|
57
|
+
},
|
|
58
|
+
])
|
|
59
|
+
.call({}, blockNumber);
|
|
60
|
+
|
|
61
|
+
const decodedData = coder.decode(['uint256'], data.returnData[0]);
|
|
62
|
+
const ratio = BigInt(decodedData[0].toString());
|
|
63
|
+
state[p.symbol.toLowerCase()] = { ratio };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return state;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const getTokenList = async (network: Network): Promise<DexParams[]> => {
|
|
70
|
+
return InceptionConfig['InceptionLRT'][network];
|
|
71
|
+
};
|
package/src/dex/index.ts
CHANGED
|
@@ -83,6 +83,7 @@ import { EtherFi } from './etherfi';
|
|
|
83
83
|
import { Spark } from './spark/spark';
|
|
84
84
|
import { VelodromeSlipstream } from './uniswap-v3/forks/velodrome-slipstream/velodrome-slipstream';
|
|
85
85
|
import { AaveV3Stata } from './aave-v3-stata/aave-v3-stata';
|
|
86
|
+
import { Inception } from './inception/inception';
|
|
86
87
|
import { OSwap } from './oswap/oswap';
|
|
87
88
|
import { ConcentratorArusd } from './concentrator-arusd/concentrator-arusd';
|
|
88
89
|
import { FxProtocolRusd } from './fx-protocol-rusd/fx-protocol-rusd';
|
|
@@ -167,6 +168,7 @@ const Dexes = [
|
|
|
167
168
|
PharaohV1,
|
|
168
169
|
Spark,
|
|
169
170
|
AaveV3Stata,
|
|
171
|
+
Inception,
|
|
170
172
|
OSwap,
|
|
171
173
|
ConcentratorArusd,
|
|
172
174
|
FxProtocolRusd,
|
package/tests/constants-e2e.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
_allowancesFn,
|
|
3
|
+
_balancesFn,
|
|
4
4
|
allowanceFn,
|
|
5
|
-
SmartToken,
|
|
6
|
-
balancesFn,
|
|
7
5
|
allowedFn,
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
balanceOfFn,
|
|
7
|
+
balancesFn,
|
|
8
|
+
SmartToken,
|
|
9
|
+
SmartTokenParams,
|
|
10
10
|
} from '../tests/smart-tokens';
|
|
11
11
|
import { Address } from '../src/types';
|
|
12
12
|
import { ETHER_ADDRESS, Network } from '../src/constants';
|
|
@@ -503,6 +503,94 @@ export const Tokens: {
|
|
|
503
503
|
address: '0x23878914efe38d27c4d67ab83ed1b93a74d4086a',
|
|
504
504
|
decimals: 6,
|
|
505
505
|
},
|
|
506
|
+
instETH: {
|
|
507
|
+
address: '0x7FA768E035F956c41d6aeaa3Bd857e7E5141CAd5',
|
|
508
|
+
decimals: 18,
|
|
509
|
+
},
|
|
510
|
+
inrETH: {
|
|
511
|
+
address: '0x80d69e79258FE9D056c822461c4eb0B4ca8802E2',
|
|
512
|
+
decimals: 18,
|
|
513
|
+
},
|
|
514
|
+
inoETH: {
|
|
515
|
+
address: '0x9181f633e9b9f15a32d5e37094f4c93b333e0e92',
|
|
516
|
+
decimals: 18,
|
|
517
|
+
},
|
|
518
|
+
inosETH: {
|
|
519
|
+
address: '0xfD07fD5EBEa6F24888a397997E262179Bf494336',
|
|
520
|
+
decimals: 18,
|
|
521
|
+
},
|
|
522
|
+
inankrETH: {
|
|
523
|
+
address: '0xfa2629B9cF3998D52726994E0FcdB750224D8B9D',
|
|
524
|
+
decimals: 18,
|
|
525
|
+
},
|
|
526
|
+
incbETH: {
|
|
527
|
+
address: '0xbf19eead55a6b100667f04f8fbc5371e03e8ab2e',
|
|
528
|
+
decimals: 18,
|
|
529
|
+
},
|
|
530
|
+
inwbETH: {
|
|
531
|
+
address: '0xda9b11cd701e10c2ec1a284f80820edd128c5246',
|
|
532
|
+
decimals: 18,
|
|
533
|
+
},
|
|
534
|
+
inswETH: {
|
|
535
|
+
address: '0xc3ade5ace1bbb033ccae8177c12ecbfa16bd6a9d',
|
|
536
|
+
decimals: 18,
|
|
537
|
+
},
|
|
538
|
+
inETHx: {
|
|
539
|
+
address: '0x57a5a0567187ff4a8dcc1a9bba86155e355878f2',
|
|
540
|
+
decimals: 18,
|
|
541
|
+
},
|
|
542
|
+
insfrxETH: {
|
|
543
|
+
address: '0x668308d77be3533c909a692302cb4d135bf8041c',
|
|
544
|
+
decimals: 18,
|
|
545
|
+
},
|
|
546
|
+
inmETH: {
|
|
547
|
+
address: '0xeCf3672A6d2147E2A77f07069Fb48d8Cf6F6Fbf9',
|
|
548
|
+
decimals: 18,
|
|
549
|
+
},
|
|
550
|
+
inlsETH: {
|
|
551
|
+
address: '0x94b888e11a9e960a9c3b3528eb6ac807b27ca62e',
|
|
552
|
+
decimals: 18,
|
|
553
|
+
},
|
|
554
|
+
inETH: {
|
|
555
|
+
address: '0xf073bAC22DAb7FaF4a3Dd6c6189a70D54110525C',
|
|
556
|
+
decimals: 18,
|
|
557
|
+
},
|
|
558
|
+
rETH: {
|
|
559
|
+
address: '0xae78736Cd615f374D3085123A210448E74Fc6393',
|
|
560
|
+
decimals: 18,
|
|
561
|
+
},
|
|
562
|
+
oETH: {
|
|
563
|
+
address: '0x856c4Efb76C1D1AE02e20CEB03A2A6a08b0b8dC3',
|
|
564
|
+
decimals: 18,
|
|
565
|
+
},
|
|
566
|
+
osETH: {
|
|
567
|
+
address: '0xf1C9acDc66974dFB6dEcB12aA385b9cD01190E38',
|
|
568
|
+
decimals: 18,
|
|
569
|
+
},
|
|
570
|
+
cbETH: {
|
|
571
|
+
address: '0xBe9895146f7AF43049ca1c1AE358B0541Ea49704',
|
|
572
|
+
decimals: 18,
|
|
573
|
+
},
|
|
574
|
+
wbETH: {
|
|
575
|
+
address: '0xa2E3356610840701BDf5611a53974510Ae27E2e1',
|
|
576
|
+
decimals: 18,
|
|
577
|
+
},
|
|
578
|
+
ETHx: {
|
|
579
|
+
address: '0xA35b1B31Ce002FBF2058D22F30f95D405200A15b',
|
|
580
|
+
decimals: 18,
|
|
581
|
+
},
|
|
582
|
+
sfrxETH: {
|
|
583
|
+
address: '0xac3E018457B222d93114458476f3E3416Abbe38F',
|
|
584
|
+
decimals: 18,
|
|
585
|
+
},
|
|
586
|
+
mETH: {
|
|
587
|
+
address: '0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa',
|
|
588
|
+
decimals: 18,
|
|
589
|
+
},
|
|
590
|
+
lsETH: {
|
|
591
|
+
address: '0x8c1BEd5b9a0928467c9B1341Da1D7BD5e10b6549',
|
|
592
|
+
decimals: 18,
|
|
593
|
+
},
|
|
506
594
|
rUSD: {
|
|
507
595
|
address: '0x65D72AA8DA931F047169112fcf34f52DbaAE7D18',
|
|
508
596
|
decimals: 18,
|
|
@@ -1522,7 +1610,7 @@ export const Holders: {
|
|
|
1522
1610
|
sDAI: '0x4C612E3B15b96Ff9A6faED838F8d07d479a8dD4c',
|
|
1523
1611
|
CVX: '0x0aCA67Fa70B142A3b9bF2eD89A81B40ff85dACdC',
|
|
1524
1612
|
MIM: '0xa046a8660e66d178ee07ec97c585eeb6aa18c26c',
|
|
1525
|
-
AnkETH: '
|
|
1613
|
+
AnkETH: '0xBB2d41AcfEA24A3A2aD4A6F95C3AcE1cC98c6ed6',
|
|
1526
1614
|
DAI: '0xd1668fb5f690c59ab4b0cabad0f8c1617895052b',
|
|
1527
1615
|
oldFRAX: '0x183d0dc5867c01bfb1dbbc41d6a9d3de6e044626',
|
|
1528
1616
|
newFRAX: '0x183d0dc5867c01bfb1dbbc41d6a9d3de6e044626',
|
|
@@ -1589,6 +1677,17 @@ export const Holders: {
|
|
|
1589
1677
|
stataUSDT: '0x6803364AceD5181877abC11E865FB27cB654a426',
|
|
1590
1678
|
aaveUSDT: '0x32c98a981Fe7C333Bd4e8E7630E8e0CF5ce20987',
|
|
1591
1679
|
weETH: '0x267ed5f71EE47D3E45Bb1569Aa37889a2d10f91e',
|
|
1680
|
+
rETH: '0x9985dF20D7e9103ECBCeb16a84956434B6f06ae8',
|
|
1681
|
+
oETH: '0xDcEe70654261AF21C44c093C300eD3Bb97b78192',
|
|
1682
|
+
osETH: '0xe080027Bd47353b5D1639772b4a75E9Ed3658A0d',
|
|
1683
|
+
cbETH: '0xd35faBF6Ec806f4D772617956A2058CdE086C6E0',
|
|
1684
|
+
wbETH: '0xc6C010287683FD3Db7865016e3e1D6468Dd73aA6',
|
|
1685
|
+
ETHx: '0x4F2083f5fBede34C2714aFfb3105539775f7FE64',
|
|
1686
|
+
sfrxETH: '0xC2545C68a71F6803264bdE885870fD72D361fB9E',
|
|
1687
|
+
mETH: '0xc3350595eD42EbE94556277bc77D257c76065291',
|
|
1688
|
+
lsETH: '0xAe60d8180437b5C34bB956822ac2710972584473',
|
|
1689
|
+
SWETH: '0xc585DF3a8C9ca0c614D023A812624bE36161502B',
|
|
1690
|
+
inankrETH: '0x310C8f5274F74258cDe1E5101b50A0502b884aC4',
|
|
1592
1691
|
rUSD: '0xEC2eda1C4F981E468ABF62424a10B69B738b498E',
|
|
1593
1692
|
arUSD: '0xeFc24206053a452e2299BF3b8f964512b041Db4C',
|
|
1594
1693
|
},
|