@paraswap/dex-lib 3.7.2 → 3.7.3-idle
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/Redstone.json +739 -0
- package/build/abi/aavev3stata/Factory.json +128 -0
- package/build/abi/aavev3stata/Token.json +735 -0
- package/build/abi/angle-transmuter/MorphoOracle.json +193 -0
- package/build/abi/angle-transmuter/MorphoVault.json +2506 -0
- package/build/abi/angle-transmuter/Pyth.json +1534 -0
- package/build/abi/angle-transmuter/Transmuter.json +1711 -0
- package/build/abi/angle-transmuter/TransmuterSidechain.json +1798 -0
- package/build/abi/idle-dao/idle-cdo-factory.json +38 -0
- package/build/abi/idle-dao/idle-cdo.json +1245 -0
- package/build/config.js +2 -0
- package/build/config.js.map +1 -1
- package/build/dex/aave-v1/aave-v1.d.ts +2 -1
- package/build/dex/aave-v1/aave-v1.js +22 -0
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/aave-v3-stata/aave-v3-stata.d.ts +50 -0
- package/build/dex/aave-v3-stata/aave-v3-stata.js +385 -0
- package/build/dex/aave-v3-stata/aave-v3-stata.js.map +1 -0
- package/build/dex/aave-v3-stata/config.d.ts +4 -0
- package/build/dex/aave-v3-stata/config.js +50 -0
- package/build/dex/aave-v3-stata/config.js.map +1 -0
- package/build/dex/aave-v3-stata/tokens.d.ts +10 -0
- package/build/dex/aave-v3-stata/tokens.js +43 -0
- package/build/dex/aave-v3-stata/tokens.js.map +1 -0
- package/build/dex/aave-v3-stata/types.d.ts +46 -0
- package/build/dex/aave-v3-stata/types.js +23 -0
- package/build/dex/aave-v3-stata/types.js.map +1 -0
- package/build/dex/aave-v3-stata/utils.d.ts +4 -0
- package/build/dex/aave-v3-stata/utils.js +67 -0
- package/build/dex/aave-v3-stata/utils.js.map +1 -0
- package/build/dex/angle-transmuter/angle-transmuter-pool.d.ts +67 -0
- package/build/dex/angle-transmuter/angle-transmuter-pool.js +448 -0
- package/build/dex/angle-transmuter/angle-transmuter-pool.js.map +1 -0
- package/build/dex/angle-transmuter/angle-transmuter.d.ts +59 -0
- package/build/dex/angle-transmuter/angle-transmuter.js +264 -0
- package/build/dex/angle-transmuter/angle-transmuter.js.map +1 -0
- package/build/dex/angle-transmuter/backedOracle.d.ts +19 -0
- package/build/dex/angle-transmuter/backedOracle.js +56 -0
- package/build/dex/angle-transmuter/backedOracle.js.map +1 -0
- package/build/dex/angle-transmuter/config.d.ts +4 -0
- package/build/dex/angle-transmuter/config.js +50 -0
- package/build/dex/angle-transmuter/config.js.map +1 -0
- package/build/dex/angle-transmuter/constants.d.ts +9 -0
- package/build/dex/angle-transmuter/constants.js +136 -0
- package/build/dex/angle-transmuter/constants.js.map +1 -0
- package/build/dex/angle-transmuter/morphoOracle.d.ts +42 -0
- package/build/dex/angle-transmuter/morphoOracle.js +179 -0
- package/build/dex/angle-transmuter/morphoOracle.js.map +1 -0
- package/build/dex/angle-transmuter/morphoVault.d.ts +20 -0
- package/build/dex/angle-transmuter/morphoVault.js +84 -0
- package/build/dex/angle-transmuter/morphoVault.js.map +1 -0
- package/build/dex/angle-transmuter/pyth.d.ts +19 -0
- package/build/dex/angle-transmuter/pyth.js +70 -0
- package/build/dex/angle-transmuter/pyth.js.map +1 -0
- package/build/dex/angle-transmuter/redstone.d.ts +20 -0
- package/build/dex/angle-transmuter/redstone.js +64 -0
- package/build/dex/angle-transmuter/redstone.js.map +1 -0
- package/build/dex/angle-transmuter/transmuter.d.ts +55 -0
- package/build/dex/angle-transmuter/transmuter.js +398 -0
- package/build/dex/angle-transmuter/transmuter.js.map +1 -0
- package/build/dex/angle-transmuter/types.d.ts +189 -0
- package/build/dex/angle-transmuter/types.js +33 -0
- package/build/dex/angle-transmuter/types.js.map +1 -0
- package/build/dex/angle-transmuter/utils.d.ts +9 -0
- package/build/dex/angle-transmuter/utils.js +257 -0
- package/build/dex/angle-transmuter/utils.js.map +1 -0
- package/build/dex/idle-dao/config.d.ts +6 -0
- package/build/dex/idle-dao/config.js +307 -0
- package/build/dex/idle-dao/config.js.map +1 -0
- package/build/dex/idle-dao/idle-dao-pool.d.ts +56 -0
- package/build/dex/idle-dao/idle-dao-pool.js +176 -0
- package/build/dex/idle-dao/idle-dao-pool.js.map +1 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +16 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.js +57 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +1 -0
- package/build/dex/idle-dao/idle-dao.d.ts +41 -0
- package/build/dex/idle-dao/idle-dao.js +238 -0
- package/build/dex/idle-dao/idle-dao.js.map +1 -0
- package/build/dex/idle-dao/scripts.d.ts +9 -0
- package/build/dex/idle-dao/scripts.js +552 -0
- package/build/dex/idle-dao/scripts.js.map +1 -0
- package/build/dex/idle-dao/tokens.d.ts +9 -0
- package/build/dex/idle-dao/tokens.js +65 -0
- package/build/dex/idle-dao/tokens.js.map +1 -0
- package/build/dex/idle-dao/types.d.ts +35 -0
- package/build/dex/idle-dao/types.js +11 -0
- package/build/dex/idle-dao/types.js.map +1 -0
- package/build/dex/idle-dao/utils.d.ts +8 -0
- package/build/dex/idle-dao/utils.js +148 -0
- package/build/dex/idle-dao/utils.js.map +1 -0
- package/build/dex/index.js +4 -0
- package/build/dex/index.js.map +1 -1
- package/build/dex/platypus/platypus.d.ts +2 -1
- package/build/dex/platypus/platypus.js +31 -0
- package/build/dex/platypus/platypus.js.map +1 -1
- package/build/dex/swaap-v1/swaap-v1.d.ts +2 -1
- package/build/dex/swaap-v1/swaap-v1.js +10 -0
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/lib/chainlink.d.ts +2 -0
- package/build/lib/chainlink.js +9 -0
- package/build/lib/chainlink.js.map +1 -1
- package/build/types.d.ts +1 -0
- package/build/utils.d.ts +1 -1
- package/package.json +1 -1
- package/src/abi/Redstone.json +739 -0
- package/src/abi/angle-transmuter/ChainlinkAccessControlledOffchainAggregator.json +1246 -0
- package/src/abi/angle-transmuter/ChainlinkEACAggregatorProxy.json +509 -0
- package/src/abi/angle-transmuter/MorphoOracle.json +193 -0
- package/src/abi/angle-transmuter/MorphoVault.json +2506 -0
- package/src/abi/angle-transmuter/Pyth.json +1534 -0
- package/src/abi/angle-transmuter/Transmuter.json +1711 -0
- package/src/abi/angle-transmuter/TransmuterSidechain.json +1798 -0
- package/src/abi/idle-dao/idle-cdo-factory.json +38 -0
- package/src/abi/idle-dao/idle-cdo.json +1245 -0
- package/src/config.ts +3 -0
- package/src/dex/angle-transmuter/angle-transmuter-e2e.test.ts +156 -0
- package/src/dex/angle-transmuter/angle-transmuter-events.test.ts +365 -0
- package/src/dex/angle-transmuter/angle-transmuter-integration.test.ts +390 -0
- package/src/dex/angle-transmuter/angle-transmuter-pool.ts +895 -0
- package/src/dex/angle-transmuter/angle-transmuter.ts +408 -0
- package/src/dex/angle-transmuter/backedOracle.ts +91 -0
- package/src/dex/angle-transmuter/config.ts +50 -0
- package/src/dex/angle-transmuter/constants.ts +138 -0
- package/src/dex/angle-transmuter/morphoOracle.ts +335 -0
- package/src/dex/angle-transmuter/morphoVault.ts +134 -0
- package/src/dex/angle-transmuter/pyth.ts +105 -0
- package/src/dex/angle-transmuter/redstone.ts +105 -0
- package/src/dex/angle-transmuter/transmuter.ts +619 -0
- package/src/dex/angle-transmuter/types.ts +203 -0
- package/src/dex/angle-transmuter/utils.ts +358 -0
- package/src/dex/idle-dao/config.ts +309 -0
- package/src/dex/idle-dao/idle-dao-e2e.test.ts +112 -0
- package/src/dex/idle-dao/idle-dao-integration.test.ts +155 -0
- package/src/dex/idle-dao/idle-dao.ts +363 -0
- package/src/dex/idle-dao/scripts.ts +553 -0
- package/src/dex/idle-dao/tokens.ts +90 -0
- package/src/dex/idle-dao/types.ts +43 -0
- package/src/dex/idle-dao/utils.ts +215 -0
- package/src/dex/index.ts +4 -0
- package/src/lib/chainlink.ts +15 -0
- package/src/types.ts +1 -0
- package/tests/constants-e2e.ts +117 -6
- package/build/abi/Uncompressor.json +0 -250
- package/build/dex/bProtocol.d.ts +0 -18
- package/build/dex/bProtocol.js +0 -39
- package/build/dex/bProtocol.js.map +0 -1
- package/build/dex/bancor.d.ts +0 -26
- package/build/dex/bancor.js +0 -58
- package/build/dex/bancor.js.map +0 -1
- package/build/dex/compound.d.ts +0 -18
- package/build/dex/compound.js +0 -46
- package/build/dex/compound.js.map +0 -1
- package/build/dex/curve-v2.d.ts +0 -58
- package/build/dex/curve-v2.js +0 -180
- package/build/dex/curve-v2.js.map +0 -1
- package/build/dex/dodo-v1.d.ts +0 -33
- package/build/dex/dodo-v1.js +0 -63
- package/build/dex/dodo-v1.js.map +0 -1
- package/build/dex/etherfi/etherfi.d.ts +0 -26
- package/build/dex/etherfi/etherfi.js +0 -96
- package/build/dex/etherfi/etherfi.js.map +0 -1
- package/build/dex/lido.d.ts +0 -19
- package/build/dex/lido.js +0 -42
- package/build/dex/lido.js.map +0 -1
- package/build/dex/onebit.d.ts +0 -25
- package/build/dex/onebit.js +0 -42
- package/build/dex/onebit.js.map +0 -1
- package/build/dex/sdai/config.d.ts +0 -11
- package/build/dex/sdai/config.js +0 -21
- package/build/dex/sdai/config.js.map +0 -1
- package/build/dex/sdai/constants.d.ts +0 -2
- package/build/dex/sdai/constants.js +0 -6
- package/build/dex/sdai/constants.js.map +0 -1
- package/build/dex/sdai/scripts/validate-state.d.ts +0 -1
- package/build/dex/sdai/scripts/validate-state.js +0 -102
- package/build/dex/sdai/scripts/validate-state.js.map +0 -1
- package/build/dex/sdai/sdai-pool.d.ts +0 -16
- package/build/dex/sdai/sdai-pool.js +0 -85
- package/build/dex/sdai/sdai-pool.js.map +0 -1
- package/build/dex/sdai/sdai.d.ts +0 -51
- package/build/dex/sdai/sdai.js +0 -172
- package/build/dex/sdai/sdai.js.map +0 -1
- package/build/dex/sdai/types.d.ts +0 -21
- package/build/dex/sdai/types.js +0 -11
- package/build/dex/sdai/types.js.map +0 -1
- package/build/dex/sdai/utils.d.ts +0 -4
- package/build/dex/sdai/utils.js +0 -39
- package/build/dex/sdai/utils.js.map +0 -1
- package/build/dex/smoothy.d.ts +0 -26
- package/build/dex/smoothy.js +0 -48
- package/build/dex/smoothy.js.map +0 -1
- package/build/dex/stable-pool.d.ts +0 -28
- package/build/dex/stable-pool.js +0 -62
- package/build/dex/stable-pool.js.map +0 -1
- package/build/dex/trader-joe-v2.1.d.ts +0 -43
- package/build/dex/trader-joe-v2.1.js +0 -79
- package/build/dex/trader-joe-v2.1.js.map +0 -1
- package/build/executor/compressor/Compressor.d.ts +0 -23
- package/build/executor/compressor/Compressor.js +0 -144
- package/build/executor/compressor/Compressor.js.map +0 -1
- package/build/executor/compressor/compress.d.ts +0 -17
- package/build/executor/compressor/compress.js +0 -187
- package/build/executor/compressor/compress.js.map +0 -1
- package/build/executor/compressor/compress_functions/addressSubstitution.d.ts +0 -6
- package/build/executor/compressor/compress_functions/addressSubstitution.js +0 -29
- package/build/executor/compressor/compress_functions/addressSubstitution.js.map +0 -1
- package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.d.ts +0 -10
- package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js +0 -40
- package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js.map +0 -1
- package/build/executor/compressor/compress_functions/byteSubstitution.d.ts +0 -11
- package/build/executor/compressor/compress_functions/byteSubstitution.js +0 -64
- package/build/executor/compressor/compress_functions/byteSubstitution.js.map +0 -1
- package/build/executor/compressor/compress_functions/ffSubstitution.d.ts +0 -7
- package/build/executor/compressor/compress_functions/ffSubstitution.js +0 -54
- package/build/executor/compressor/compress_functions/ffSubstitution.js.map +0 -1
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute.d.ts +0 -8
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js +0 -67
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js.map +0 -1
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.d.ts +0 -8
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js +0 -61
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js.map +0 -1
- package/build/executor/compressor/compress_functions/reverseAddressSubstitution.d.ts +0 -6
- package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js +0 -37
- package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js.map +0 -1
- package/build/executor/compressor/compress_functions/searchUnusedBytes.d.ts +0 -9
- package/build/executor/compressor/compress_functions/searchUnusedBytes.js +0 -33
- package/build/executor/compressor/compress_functions/searchUnusedBytes.js.map +0 -1
- package/build/executor/compressor/fetchSaved.d.ts +0 -0
- package/build/executor/compressor/fetchSaved.js +0 -17
- package/build/executor/compressor/fetchSaved.js.map +0 -1
- package/build/executor/compressor/utils/computeCostL2.d.ts +0 -2
- package/build/executor/compressor/utils/computeCostL2.js +0 -14
- package/build/executor/compressor/utils/computeCostL2.js.map +0 -1
- package/build/executor/compressor/utils/findLongestDuplicatedString.d.ts +0 -2
- package/build/executor/compressor/utils/findLongestDuplicatedString.js +0 -30
- package/build/executor/compressor/utils/findLongestDuplicatedString.js.map +0 -1
- package/build/executor/compressor/utils/getAllIndexes.d.ts +0 -2
- package/build/executor/compressor/utils/getAllIndexes.js +0 -12
- package/build/executor/compressor/utils/getAllIndexes.js.map +0 -1
- package/build/executor/compressor/utils/getByteForAddress.d.ts +0 -2
- package/build/executor/compressor/utils/getByteForAddress.js +0 -14
- package/build/executor/compressor/utils/getByteForAddress.js.map +0 -1
- package/build/executor/compressor/utils/intTo2Bytes.d.ts +0 -2
- package/build/executor/compressor/utils/intTo2Bytes.js +0 -14
- package/build/executor/compressor/utils/intTo2Bytes.js.map +0 -1
- package/build/executor/compressor/utils/intTo3Bytes.d.ts +0 -2
- package/build/executor/compressor/utils/intTo3Bytes.js +0 -18
- package/build/executor/compressor/utils/intTo3Bytes.js.map +0 -1
- package/build/executor/compressor/utils/intToByte.d.ts +0 -2
- package/build/executor/compressor/utils/intToByte.js +0 -10
- package/build/executor/compressor/utils/intToByte.js.map +0 -1
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { endpoints, TOKEN_LISTS } from './config';
|
|
2
|
+
import { BytesLike } from 'ethers';
|
|
3
|
+
import BigNumber from 'bignumber.js';
|
|
4
|
+
import { Interface } from '@ethersproject/abi';
|
|
5
|
+
import { stringDecode, addressDecode, uint8ToNumber } from '../../lib/decoders';
|
|
6
|
+
import {
|
|
7
|
+
MultiCallParams,
|
|
8
|
+
MultiResult,
|
|
9
|
+
MultiWrapper,
|
|
10
|
+
} from '../../lib/multi-wrapper';
|
|
11
|
+
import { IdleToken, TrancheToken } from './types';
|
|
12
|
+
import axios from 'axios';
|
|
13
|
+
import { Network } from '../../constants';
|
|
14
|
+
import { IDexHelper } from '../../dex-helper';
|
|
15
|
+
|
|
16
|
+
export const BNify = (s: any): BigNumber =>
|
|
17
|
+
new BigNumber(typeof s === 'object' ? s : String(s));
|
|
18
|
+
|
|
19
|
+
async function _getIdleTokenSymbols(
|
|
20
|
+
blockNumber: number,
|
|
21
|
+
idleTokens: string[],
|
|
22
|
+
erc20Interface: Interface,
|
|
23
|
+
multiWrapper: MultiWrapper,
|
|
24
|
+
): Promise<any> {
|
|
25
|
+
let calls: MultiCallParams<any>[] = [];
|
|
26
|
+
|
|
27
|
+
for (const idleAddress of idleTokens) {
|
|
28
|
+
calls.push({
|
|
29
|
+
target: idleAddress,
|
|
30
|
+
callData: erc20Interface.encodeFunctionData('symbol', []),
|
|
31
|
+
decodeFunction: (result: MultiResult<BytesLike> | BytesLike): any => {
|
|
32
|
+
return {
|
|
33
|
+
idleAddress,
|
|
34
|
+
idleSymbol: stringDecode(result),
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const results = await multiWrapper.aggregate<any>(calls, blockNumber);
|
|
40
|
+
|
|
41
|
+
return results.reduce((output, item) => {
|
|
42
|
+
return {
|
|
43
|
+
...output,
|
|
44
|
+
[item.idleAddress]: item.idleSymbol,
|
|
45
|
+
};
|
|
46
|
+
}, {});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function _getIdleTokenDecimals(
|
|
50
|
+
blockNumber: number,
|
|
51
|
+
underlyingTokens: string[],
|
|
52
|
+
erc20Interface: Interface,
|
|
53
|
+
multiWrapper: MultiWrapper,
|
|
54
|
+
): Promise<any> {
|
|
55
|
+
let calls: MultiCallParams<any>[] = [];
|
|
56
|
+
|
|
57
|
+
for (const address of underlyingTokens) {
|
|
58
|
+
calls.push({
|
|
59
|
+
target: address,
|
|
60
|
+
callData: erc20Interface.encodeFunctionData('decimals', []),
|
|
61
|
+
decodeFunction: (result: MultiResult<BytesLike> | BytesLike): any => {
|
|
62
|
+
return {
|
|
63
|
+
address,
|
|
64
|
+
decimals: uint8ToNumber(result),
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const results = await multiWrapper.aggregate<any>(calls, blockNumber);
|
|
70
|
+
|
|
71
|
+
return results.reduce((output, item) => {
|
|
72
|
+
return {
|
|
73
|
+
...output,
|
|
74
|
+
[item.address]: item.decimals,
|
|
75
|
+
};
|
|
76
|
+
}, {});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const getDataWithAuth = async (
|
|
80
|
+
endpoint: string,
|
|
81
|
+
token: string,
|
|
82
|
+
error_callback?: Function,
|
|
83
|
+
) => {
|
|
84
|
+
const config = {
|
|
85
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const data = await axios.post(endpoint, {}, config).catch(err => {
|
|
89
|
+
if (typeof error_callback === 'function') {
|
|
90
|
+
error_callback(err);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return data?.data;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const fetchTokenList_api = async (
|
|
97
|
+
network: Network,
|
|
98
|
+
dexHelper: IDexHelper,
|
|
99
|
+
blockNumber: number,
|
|
100
|
+
cdoInterface: Interface,
|
|
101
|
+
erc20Interface: Interface,
|
|
102
|
+
multiWrapper: MultiWrapper,
|
|
103
|
+
token: string,
|
|
104
|
+
): Promise<IdleToken[]> => {
|
|
105
|
+
const data = await getDataWithAuth(endpoints[network], token);
|
|
106
|
+
|
|
107
|
+
// Fetch tokenslist from static file
|
|
108
|
+
if (!data) {
|
|
109
|
+
return TOKEN_LISTS;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const deployedContract = data
|
|
113
|
+
.filter((d: any) => !!d.cdoAddress)
|
|
114
|
+
.reduce((acc: any[], d: any) => {
|
|
115
|
+
if (acc.includes(d.cdoAddress)) return acc;
|
|
116
|
+
return [...acc, d.cdoAddress];
|
|
117
|
+
}, []);
|
|
118
|
+
|
|
119
|
+
const calls = deployedContract.reduce(
|
|
120
|
+
(calls: MultiCallParams<any>[], cdoAddress: string) => {
|
|
121
|
+
calls.push({
|
|
122
|
+
target: cdoAddress,
|
|
123
|
+
callData: cdoInterface.encodeFunctionData('AATranche', []),
|
|
124
|
+
decodeFunction: (
|
|
125
|
+
result: MultiResult<BytesLike> | BytesLike,
|
|
126
|
+
): TrancheToken => {
|
|
127
|
+
return {
|
|
128
|
+
cdoAddress,
|
|
129
|
+
tokenType: 'AA',
|
|
130
|
+
idleAddress: addressDecode(result),
|
|
131
|
+
};
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
calls.push({
|
|
136
|
+
target: cdoAddress,
|
|
137
|
+
callData: cdoInterface.encodeFunctionData('BBTranche', []),
|
|
138
|
+
decodeFunction: (
|
|
139
|
+
result: MultiResult<BytesLike> | BytesLike,
|
|
140
|
+
): TrancheToken => {
|
|
141
|
+
return {
|
|
142
|
+
cdoAddress,
|
|
143
|
+
tokenType: 'BB',
|
|
144
|
+
idleAddress: addressDecode(result),
|
|
145
|
+
};
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
calls.push({
|
|
150
|
+
target: cdoAddress,
|
|
151
|
+
callData: cdoInterface.encodeFunctionData('token', []),
|
|
152
|
+
decodeFunction: (result: MultiResult<BytesLike> | BytesLike): any => {
|
|
153
|
+
return {
|
|
154
|
+
cdoAddress,
|
|
155
|
+
address: addressDecode(result),
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
return calls;
|
|
161
|
+
},
|
|
162
|
+
[],
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
const results = await multiWrapper.aggregate<Record<string, string>>(
|
|
166
|
+
calls,
|
|
167
|
+
blockNumber,
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
const cdosUnderlying: Record<string, string> = results.reduce(
|
|
171
|
+
(cdosUnderlying, result: any) => {
|
|
172
|
+
if (!result.address) return cdosUnderlying;
|
|
173
|
+
return {
|
|
174
|
+
...cdosUnderlying,
|
|
175
|
+
[result.cdoAddress]: result.address,
|
|
176
|
+
};
|
|
177
|
+
},
|
|
178
|
+
{},
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
const idleTokenSymbolsList = await _getIdleTokenSymbols(
|
|
182
|
+
blockNumber,
|
|
183
|
+
results
|
|
184
|
+
.filter(result => !!result.tokenType)
|
|
185
|
+
.map(result => result.idleAddress),
|
|
186
|
+
erc20Interface,
|
|
187
|
+
multiWrapper,
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
const idleTokenDecimals = await _getIdleTokenDecimals(
|
|
191
|
+
blockNumber,
|
|
192
|
+
results.filter(result => !result.tokenType).map(result => result.address),
|
|
193
|
+
erc20Interface,
|
|
194
|
+
multiWrapper,
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
const output: IdleToken[] = [];
|
|
198
|
+
for (const result of results) {
|
|
199
|
+
if (result.tokenType) {
|
|
200
|
+
const idleToken: IdleToken = {
|
|
201
|
+
blockNumber: 0,
|
|
202
|
+
idleDecimals: 18,
|
|
203
|
+
cdoAddress: result.cdoAddress,
|
|
204
|
+
idleAddress: result.idleAddress,
|
|
205
|
+
address: cdosUnderlying[result.cdoAddress],
|
|
206
|
+
idleSymbol: idleTokenSymbolsList[result.idleAddress],
|
|
207
|
+
tokenType: result.tokenType as IdleToken['tokenType'],
|
|
208
|
+
decimals: idleTokenDecimals[cdosUnderlying[result.cdoAddress]],
|
|
209
|
+
};
|
|
210
|
+
output.push(idleToken);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return output;
|
|
215
|
+
};
|
package/src/dex/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ import { Onebit } from './onebit/onebit';
|
|
|
25
25
|
import { Compound } from './compound/compound';
|
|
26
26
|
import { AaveV2 } from './aave-v2/aave-v2';
|
|
27
27
|
import { AaveV3 } from './aave-v3/aave-v3';
|
|
28
|
+
import { IdleDao } from './idle-dao/idle-dao';
|
|
28
29
|
import { OneInchLp } from './OneInchLp';
|
|
29
30
|
import { DodoV1 } from './dodo-v1/dodo-v1';
|
|
30
31
|
import { DodoV2 } from './dodo-v2';
|
|
@@ -75,6 +76,7 @@ import { SwaapV2 } from './swaap-v2/swaap-v2';
|
|
|
75
76
|
import { TraderJoeV21 } from './trader-joe-v2.1/trader-joe-v2.1';
|
|
76
77
|
import { PancakeswapV3 } from './pancakeswap-v3/pancakeswap-v3';
|
|
77
78
|
import { Algebra } from './algebra/algebra';
|
|
79
|
+
import { AngleTransmuter } from './angle-transmuter/angle-transmuter';
|
|
78
80
|
import { AngleStakedStable } from './angle-staked-stable/angle-staked-stable';
|
|
79
81
|
import { QuickPerps } from './quick-perps/quick-perps';
|
|
80
82
|
import { NomiswapV2 } from './uniswap-v2/nomiswap-v2';
|
|
@@ -128,6 +130,7 @@ const Dexes = [
|
|
|
128
130
|
Excalibur,
|
|
129
131
|
AaveV2,
|
|
130
132
|
AaveV3,
|
|
133
|
+
IdleDao,
|
|
131
134
|
KyberDmm,
|
|
132
135
|
Weth,
|
|
133
136
|
PolygonMigrator,
|
|
@@ -158,6 +161,7 @@ const Dexes = [
|
|
|
158
161
|
MaverickV2,
|
|
159
162
|
Camelot,
|
|
160
163
|
SwaapV2,
|
|
164
|
+
AngleTransmuter,
|
|
161
165
|
AngleStakedStable,
|
|
162
166
|
QuickPerps,
|
|
163
167
|
NomiswapV2,
|
package/src/lib/chainlink.ts
CHANGED
|
@@ -49,6 +49,21 @@ export class ChainLinkSubscriber<State> extends PartialEventSubscriber<
|
|
|
49
49
|
)[0];
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
static getReadDecimal(proxy: Address): MultiCallInput {
|
|
53
|
+
return {
|
|
54
|
+
target: proxy,
|
|
55
|
+
callData:
|
|
56
|
+
ChainLinkSubscriber.proxyInterface.encodeFunctionData('decimals'),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static readDecimals(multicallOutput: MultiCallOutput): Address {
|
|
61
|
+
return ChainLinkSubscriber.proxyInterface.decodeFunctionResult(
|
|
62
|
+
'decimals',
|
|
63
|
+
multicallOutput,
|
|
64
|
+
)[0];
|
|
65
|
+
}
|
|
66
|
+
|
|
52
67
|
public processLog(
|
|
53
68
|
state: DeepReadonly<ChainLinkState>,
|
|
54
69
|
log: Readonly<Log>,
|
package/src/types.ts
CHANGED
package/tests/constants-e2e.ts
CHANGED
|
@@ -19,6 +19,58 @@ export const Tokens: {
|
|
|
19
19
|
[network: number]: { [symbol: string]: SmartTokenParams };
|
|
20
20
|
} = {
|
|
21
21
|
[Network.MAINNET]: {
|
|
22
|
+
AA_wstETH: {
|
|
23
|
+
decimals: 18,
|
|
24
|
+
address: '0x2688fc68c4eac90d9e5e1b94776cf14eade8d877',
|
|
25
|
+
},
|
|
26
|
+
'AA_idle_cpPOR-USDC': {
|
|
27
|
+
decimals: 18,
|
|
28
|
+
address: '0x9cacd44cfdf22731bc99facf3531c809d56bd4a2',
|
|
29
|
+
},
|
|
30
|
+
'BB_idle_cpFAS-USDT': {
|
|
31
|
+
decimals: 18,
|
|
32
|
+
address: '0x3eb6318b8d9f362a0e1d99f6032edb1c4c602500',
|
|
33
|
+
},
|
|
34
|
+
AA_steakUSDC: {
|
|
35
|
+
decimals: 18,
|
|
36
|
+
address: '0x2b0e31b8ee653d2077db86dea3acf3f34ae9d5d2',
|
|
37
|
+
},
|
|
38
|
+
BB_steakUSDC: {
|
|
39
|
+
decimals: 18,
|
|
40
|
+
address: '0x7b713b1cb6eafd4061064581579ffccf7df21545',
|
|
41
|
+
},
|
|
42
|
+
AA_Re7WETH: {
|
|
43
|
+
decimals: 18,
|
|
44
|
+
address: '0x454bb3cb427b21e1c052a080e21a57753cd6969e',
|
|
45
|
+
},
|
|
46
|
+
BB_Re7WETH: {
|
|
47
|
+
decimals: 18,
|
|
48
|
+
address: '0x20aa3cd83044d2903181f7ef5c2b498a017d1c4a',
|
|
49
|
+
},
|
|
50
|
+
BB_dUSDCV3: {
|
|
51
|
+
decimals: 18,
|
|
52
|
+
address: '0x2a84a042db06222c486bcb815e961f26599d0df6',
|
|
53
|
+
},
|
|
54
|
+
AA_sUSDe: {
|
|
55
|
+
decimals: 18,
|
|
56
|
+
address: '0xf3188697bd35df73e4293d04a07ebaaf1ffc4018',
|
|
57
|
+
},
|
|
58
|
+
BB_sUSDe: {
|
|
59
|
+
decimals: 18,
|
|
60
|
+
address: '0xb8d0be502a8f12cc5213733285b430a43d07349d',
|
|
61
|
+
},
|
|
62
|
+
AA_iETHv2: {
|
|
63
|
+
decimals: 18,
|
|
64
|
+
address: '0xdf17c739b666B259DA3416d01f0310a6e429f592',
|
|
65
|
+
},
|
|
66
|
+
BB_iETHv2: {
|
|
67
|
+
decimals: 18,
|
|
68
|
+
address: '0x990b3aF34dDB502715E1070CE6778d8eB3c8Ea82',
|
|
69
|
+
},
|
|
70
|
+
USDE: {
|
|
71
|
+
address: '0x4c9edd5852cd905f086c759e8383e09bff1e68b3',
|
|
72
|
+
decimals: 18,
|
|
73
|
+
},
|
|
22
74
|
ETH: {
|
|
23
75
|
address: ETHER_ADDRESS,
|
|
24
76
|
decimals: 18,
|
|
@@ -46,6 +98,7 @@ export const Tokens: {
|
|
|
46
98
|
USDC: {
|
|
47
99
|
address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
48
100
|
decimals: 6,
|
|
101
|
+
symbol: 'USDC',
|
|
49
102
|
addBalance: balancesFn,
|
|
50
103
|
addAllowance: allowedFn,
|
|
51
104
|
},
|
|
@@ -350,6 +403,22 @@ export const Tokens: {
|
|
|
350
403
|
EURA: {
|
|
351
404
|
address: '0x1a7e4e63778b4f12a199c062f3efdd288afcbce8',
|
|
352
405
|
decimals: 18,
|
|
406
|
+
symbol: 'EURA',
|
|
407
|
+
},
|
|
408
|
+
EUROC: {
|
|
409
|
+
address: '0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c',
|
|
410
|
+
decimals: 6,
|
|
411
|
+
symbol: 'EUROC',
|
|
412
|
+
},
|
|
413
|
+
bERNX: {
|
|
414
|
+
address: '0x3f95AA88dDbB7D9D484aa3D482bf0a80009c52c9',
|
|
415
|
+
decimals: 18,
|
|
416
|
+
symbol: 'bERNX',
|
|
417
|
+
},
|
|
418
|
+
bC3M: {
|
|
419
|
+
address: '0x2F123cF3F37CE3328CC9B5b8415f9EC5109b45e7',
|
|
420
|
+
decimals: 18,
|
|
421
|
+
symbol: 'bC3M',
|
|
353
422
|
},
|
|
354
423
|
stEUR: {
|
|
355
424
|
address: '0x004626a008b1acdc4c74ab51644093b155e59a23',
|
|
@@ -358,6 +427,17 @@ export const Tokens: {
|
|
|
358
427
|
USDA: {
|
|
359
428
|
address: '0x0000206329b97DB379d5E1Bf586BbDB969C63274',
|
|
360
429
|
decimals: 18,
|
|
430
|
+
symbol: 'USDA',
|
|
431
|
+
},
|
|
432
|
+
bIB01: {
|
|
433
|
+
address: '0xCA30c93B02514f86d5C86a6e375E3A330B435Fb5',
|
|
434
|
+
decimals: 18,
|
|
435
|
+
symbol: 'bIB01',
|
|
436
|
+
},
|
|
437
|
+
steakUSDC: {
|
|
438
|
+
address: '0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB',
|
|
439
|
+
decimals: 18,
|
|
440
|
+
symbol: 'steakUSDC',
|
|
361
441
|
},
|
|
362
442
|
stUSD: {
|
|
363
443
|
address: '0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776',
|
|
@@ -565,6 +645,7 @@ export const Tokens: {
|
|
|
565
645
|
EURA: {
|
|
566
646
|
address: '0xe0b52e49357fd4daf2c15e02058dce6bc0057db4',
|
|
567
647
|
decimals: 18,
|
|
648
|
+
symbol: 'EURA',
|
|
568
649
|
},
|
|
569
650
|
stEUR: {
|
|
570
651
|
address: '0x004626a008b1acdc4c74ab51644093b155e59a23',
|
|
@@ -573,6 +654,7 @@ export const Tokens: {
|
|
|
573
654
|
USDA: {
|
|
574
655
|
address: '0x0000206329b97DB379d5E1Bf586BbDB969C63274',
|
|
575
656
|
decimals: 18,
|
|
657
|
+
symbol: 'USDA',
|
|
576
658
|
},
|
|
577
659
|
stUSD: {
|
|
578
660
|
address: '0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776',
|
|
@@ -791,10 +873,12 @@ export const Tokens: {
|
|
|
791
873
|
EURA: {
|
|
792
874
|
address: '0x12f31B73D812C6Bb0d735a218c086d44D5fe5f89',
|
|
793
875
|
decimals: 18,
|
|
876
|
+
symbol: 'EURA',
|
|
794
877
|
},
|
|
795
878
|
USDA: {
|
|
796
879
|
address: '0x0000206329b97DB379d5E1Bf586BbDB969C63274',
|
|
797
880
|
decimals: 18,
|
|
881
|
+
symbol: 'USDA',
|
|
798
882
|
},
|
|
799
883
|
stUSD: {
|
|
800
884
|
address: '0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776',
|
|
@@ -993,8 +1077,9 @@ export const Tokens: {
|
|
|
993
1077
|
decimals: 6,
|
|
994
1078
|
},
|
|
995
1079
|
USDC: {
|
|
996
|
-
address: '
|
|
1080
|
+
address: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
|
|
997
1081
|
decimals: 6,
|
|
1082
|
+
symbol: 'USDC',
|
|
998
1083
|
},
|
|
999
1084
|
crvUSD: {
|
|
1000
1085
|
address: '0x498bf2b1e120fed3ad3d42ea2165e9b73f99c1e5',
|
|
@@ -1061,6 +1146,7 @@ export const Tokens: {
|
|
|
1061
1146
|
EURA: {
|
|
1062
1147
|
address: '0xfa5ed56a203466cbbc2430a43c66b9d8723528e7',
|
|
1063
1148
|
decimals: 18,
|
|
1149
|
+
symbol: 'EURA',
|
|
1064
1150
|
},
|
|
1065
1151
|
stEUR: {
|
|
1066
1152
|
address: '0x004626a008b1acdc4c74ab51644093b155e59a23',
|
|
@@ -1069,6 +1155,7 @@ export const Tokens: {
|
|
|
1069
1155
|
USDA: {
|
|
1070
1156
|
address: '0x0000206329b97DB379d5E1Bf586BbDB969C63274',
|
|
1071
1157
|
decimals: 18,
|
|
1158
|
+
symbol: 'USDA',
|
|
1072
1159
|
},
|
|
1073
1160
|
stUSD: {
|
|
1074
1161
|
address: '0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776',
|
|
@@ -1188,6 +1275,7 @@ export const Tokens: {
|
|
|
1188
1275
|
EURA: {
|
|
1189
1276
|
address: '0x9485aca5bbbe1667ad97c7fe7c4531a624c8b1ed',
|
|
1190
1277
|
decimals: 18,
|
|
1278
|
+
symbol: 'EURA',
|
|
1191
1279
|
},
|
|
1192
1280
|
stEUR: {
|
|
1193
1281
|
address: '0x004626a008b1acdc4c74ab51644093b155e59a23',
|
|
@@ -1196,6 +1284,7 @@ export const Tokens: {
|
|
|
1196
1284
|
USDA: {
|
|
1197
1285
|
address: '0x0000206329b97DB379d5E1Bf586BbDB969C63274',
|
|
1198
1286
|
decimals: 18,
|
|
1287
|
+
symbol: 'USDA',
|
|
1199
1288
|
},
|
|
1200
1289
|
stUSD: {
|
|
1201
1290
|
address: '0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776',
|
|
@@ -1246,7 +1335,8 @@ export const Tokens: {
|
|
|
1246
1335
|
decimals: 18,
|
|
1247
1336
|
},
|
|
1248
1337
|
USDC: {
|
|
1249
|
-
address: '
|
|
1338
|
+
address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
1339
|
+
symbol: 'USDC',
|
|
1250
1340
|
decimals: 6,
|
|
1251
1341
|
},
|
|
1252
1342
|
USDM: {
|
|
@@ -1292,10 +1382,12 @@ export const Tokens: {
|
|
|
1292
1382
|
EURA: {
|
|
1293
1383
|
address: '0xA61BeB4A3d02decb01039e378237032B351125B4',
|
|
1294
1384
|
decimals: 18,
|
|
1385
|
+
symbol: 'EURA',
|
|
1295
1386
|
},
|
|
1296
1387
|
USDA: {
|
|
1297
1388
|
address: '0x0000206329b97DB379d5E1Bf586BbDB969C63274',
|
|
1298
1389
|
decimals: 18,
|
|
1390
|
+
symbol: 'USDA',
|
|
1299
1391
|
},
|
|
1300
1392
|
stUSD: {
|
|
1301
1393
|
address: '0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776',
|
|
@@ -1313,8 +1405,22 @@ export const Holders: {
|
|
|
1313
1405
|
[network: number]: { [tokenAddress: string]: Address };
|
|
1314
1406
|
} = {
|
|
1315
1407
|
[Network.MAINNET]: {
|
|
1316
|
-
|
|
1317
|
-
|
|
1408
|
+
// Idle tokens
|
|
1409
|
+
AA_wstETH: '0xd7C1b48877A7dFA7D51cf1144c89C0A3F134F935',
|
|
1410
|
+
'AA_idle_cpPOR-USDC': '0x085c8eaccA6911fE60aE3f8FbAe5F3012E3A05Ec',
|
|
1411
|
+
'BB_idle_cpFAS-USDT': '0xFDAD59EF0686C3Da702b7D651a3bD35a539c8Bc4',
|
|
1412
|
+
AA_steakUSDC: '0x28C1eCF5B0f16E1D85B9D2677EfB79d68167cAf2',
|
|
1413
|
+
BB_steakUSDC: '0x442Aea0Fd2AFbd3391DAE768F7046f132F0a6300',
|
|
1414
|
+
AA_Re7WETH: '0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb',
|
|
1415
|
+
BB_Re7WETH: '0x442Aea0Fd2AFbd3391DAE768F7046f132F0a6300',
|
|
1416
|
+
BB_dUSDCV3: '0xFb3bD022D5DAcF95eE28a6B07825D4Ff9C5b3814',
|
|
1417
|
+
AA_sUSDe: '0xaFeb95DEF3B2A3D532D74DaBd51E62048d6c07A4',
|
|
1418
|
+
BB_sUSDe: '0xaFeb95DEF3B2A3D532D74DaBd51E62048d6c07A4',
|
|
1419
|
+
AA_iETHv2: '0xA118aD79E2152b9a3c7Df8B8791887762b0f1D49',
|
|
1420
|
+
BB_iETHv2: '0x15079cBAa74C1df2a602fAc88Bd5b98B08FfE6A4',
|
|
1421
|
+
ETH: '0x176F3DAb24a159341c0509bB36B833E7fdd0a132',
|
|
1422
|
+
USDC: '0x7713974908be4bed47172370115e8b1219f4a5f0',
|
|
1423
|
+
USDE: '0x8707f238936c12c309bfc2B9959C35828AcFc512',
|
|
1318
1424
|
AMPL: '0x223592a191ECfC7FDC38a9256c3BD96E771539A9',
|
|
1319
1425
|
WBTC: '0x6daB3bCbFb336b29d06B9C793AEF7eaA57888922',
|
|
1320
1426
|
tBTCv2: '0x84eA3907b9206427F45c7b2614925a2B86D12611',
|
|
@@ -1323,7 +1429,7 @@ export const Holders: {
|
|
|
1323
1429
|
aEthUSDC: '0x42EFD1E0DB4ADa762cc5092ECBD052dE7c6e72E2',
|
|
1324
1430
|
MAV: '0x92582aa69BB6117903a01eDdfe6EFfDDe564A69f',
|
|
1325
1431
|
BADGER: '0x34e2741a3f8483dbe5231f61c005110ff4b9f50a',
|
|
1326
|
-
STETH: '
|
|
1432
|
+
STETH: '0x6663613FbD927cE78abBF7F5Ca7e2c3FE0d96d18',
|
|
1327
1433
|
SUSHI: '0x8a108e4761386c94b8d2f98A5fFe13E472cFE76a',
|
|
1328
1434
|
wstETH: '0x5fEC2f34D80ED82370F733043B6A536d7e9D7f8d',
|
|
1329
1435
|
WETH: '0x6B44ba0a126a2A1a8aa6cD1AdeeD002e141Bcd44',
|
|
@@ -1377,6 +1483,11 @@ export const Holders: {
|
|
|
1377
1483
|
aEthWETH: '0xfEA3F5b06D41Cb1526b9cAf8be63c5b37C475f23',
|
|
1378
1484
|
dUSDC: '0x2FC2F705110A7F46Ce85F701d7217EF1018f01A3',
|
|
1379
1485
|
PSP: '0xE5E5440a1CE69C5cf67BFFA74d185e57c31b43E5',
|
|
1486
|
+
EUROC: '0x64AE5802620398143FC7113037769175F74825Ea',
|
|
1487
|
+
bC3M: '0x5f9F41497f9e11fd7D4c4B067413199682eE2CFF',
|
|
1488
|
+
bERNX: '0x5F7A4c11bde4f218f0025Ef444c369d838ffa2aD',
|
|
1489
|
+
bIB01: '0x5F7A4c11bde4f218f0025Ef444c369d838ffa2aD',
|
|
1490
|
+
steakUSDC: '0xC977d218Fde6A39c7aCE71C8243545c276B48931',
|
|
1380
1491
|
EURA: '0xa116f421ff82a9704428259fd8cc63347127b777',
|
|
1381
1492
|
stEUR: '0xdC7Aa225964267c7E0EfB35f4931426209E90312',
|
|
1382
1493
|
USDA: '0x2686bC6A56D205010637CE1DF124b20Cb19E4054',
|
|
@@ -1609,7 +1720,7 @@ export const Holders: {
|
|
|
1609
1720
|
SDEX: '0xa5d378c05192e3f1f365d6298921879c4d51c5a3',
|
|
1610
1721
|
EURA: '0x5b5614b9fffab7c751799eb12d5cb9165c8c40ad',
|
|
1611
1722
|
stEUR: '0xA9DdD91249DFdd450E81E1c56Ab60E1A62651701',
|
|
1612
|
-
USDA: '
|
|
1723
|
+
USDA: '0x7FE4b2632f5AE6d930677D662AF26Bc0a06672b3',
|
|
1613
1724
|
stUSD: '0x8deeffb6047b8ee91b09334eb2a4ca120f43f596',
|
|
1614
1725
|
ALB: '0x365c6d588e8611125de3bea5b9280c304fa54113',
|
|
1615
1726
|
AERO: '0x807877258b55bfefabdd469da1c72731c5070839',
|