@paraswap/dex-lib 3.8.33 → 3.8.34-inception.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/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/inception/inception.js +9 -1
- package/build/dex/inception/inception.js.map +1 -1
- package/build/dex/inception/utils.d.ts +0 -1
- package/build/dex/inception/utils.js +1 -22
- package/build/dex/inception/utils.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 +80 -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 +279 -0
- package/src/dex/inception/tokens.ts +37 -0
- package/src/dex/inception/types.ts +26 -0
- package/src/dex/inception/utils.ts +44 -0
- package/src/dex/index.ts +2 -0
- package/tests/constants-e2e.ts +106 -7
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Network } from '../../constants';
|
|
2
|
+
import { DexParams } from './types';
|
|
3
|
+
|
|
4
|
+
export const Tokens: { [network: number]: { [symbol: string]: DexParams } } =
|
|
5
|
+
{};
|
|
6
|
+
|
|
7
|
+
const TokensByAddress: {
|
|
8
|
+
[network: number]: { [address: string]: DexParams };
|
|
9
|
+
} = {};
|
|
10
|
+
|
|
11
|
+
export function setTokensOnNetwork(network: Network, tokens: DexParams[]) {
|
|
12
|
+
if (Tokens[network] === undefined) {
|
|
13
|
+
Tokens[network] = {};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (TokensByAddress[network] === undefined) {
|
|
17
|
+
TokensByAddress[network] = {};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
for (let token of tokens) {
|
|
21
|
+
token.vault = token.vault.toLowerCase();
|
|
22
|
+
token.token = token.token.toLowerCase();
|
|
23
|
+
token.baseToken = token.baseToken.toLowerCase();
|
|
24
|
+
|
|
25
|
+
Tokens[network][token.symbol] = token;
|
|
26
|
+
TokensByAddress[network][token.vault] = token;
|
|
27
|
+
TokensByAddress[network][token.token] = token;
|
|
28
|
+
TokensByAddress[network][token.baseToken] = token;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function getTokenFromAddress(
|
|
33
|
+
network: Network,
|
|
34
|
+
address: string,
|
|
35
|
+
): DexParams | undefined {
|
|
36
|
+
return TokensByAddress[network]?.[address.toLowerCase()];
|
|
37
|
+
}
|
|
@@ -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,44 @@
|
|
|
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 getOnChainState(
|
|
10
|
+
multiContract: Contract,
|
|
11
|
+
poolInterface: Interface,
|
|
12
|
+
network: Network,
|
|
13
|
+
blockNumber: number | 'latest',
|
|
14
|
+
): Promise<PoolState> {
|
|
15
|
+
let tokenList = await getTokenList(network);
|
|
16
|
+
const state: PoolState = {};
|
|
17
|
+
for (const p of tokenList) {
|
|
18
|
+
let addr;
|
|
19
|
+
if (p.baseTokenSlug === 'ETH') {
|
|
20
|
+
addr = p.token;
|
|
21
|
+
} else {
|
|
22
|
+
addr = p.vault;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const data = await multiContract.methods
|
|
26
|
+
.aggregate([
|
|
27
|
+
{
|
|
28
|
+
target: addr,
|
|
29
|
+
callData: poolInterface.encodeFunctionData('ratio', []),
|
|
30
|
+
},
|
|
31
|
+
])
|
|
32
|
+
.call({}, blockNumber);
|
|
33
|
+
|
|
34
|
+
const decodedData = coder.decode(['uint256'], data.returnData[0]);
|
|
35
|
+
const ratio = BigInt(decodedData[0].toString());
|
|
36
|
+
state[p.symbol.toLowerCase()] = { ratio };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return state;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const getTokenList = async (network: Network): Promise<DexParams[]> => {
|
|
43
|
+
return InceptionConfig['InceptionLRT'][network];
|
|
44
|
+
};
|
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
|
},
|