@paraswap/dex-lib 3.11.5 → 3.11.6
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/.idea/aws.xml +17 -0
- package/.idea/codeStyles/Project.xml +19 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/paraswap-dex-lib.iml +9 -0
- package/.idea/prettier.xml +7 -0
- package/.idea/vcs.xml +6 -0
- package/build/abi/{inception/inception-ineth-pool.json → cables/CablesMainnetRFQ.json} +511 -490
- package/build/abi/fluid-dex/resolver.abi.json +731 -4
- package/build/abi/integral/factory.json +333 -0
- package/build/abi/integral/oracle.json +501 -0
- package/build/abi/integral/pool.json +1041 -0
- package/build/abi/{wombat/pool.json → integral/relayer.json} +720 -473
- package/build/dex/aave-v1/aave-v1.d.ts +1 -2
- package/build/dex/aave-v1/aave-v1.js +0 -23
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/cables/cables.d.ts +59 -0
- package/build/dex/cables/cables.js +599 -0
- package/build/dex/cables/cables.js.map +1 -0
- package/build/dex/cables/config.d.ts +4 -0
- package/build/dex/cables/config.js +15 -0
- package/build/dex/cables/config.js.map +1 -0
- package/build/dex/cables/constants.d.ts +20 -0
- package/build/dex/cables/constants.js +24 -0
- package/build/dex/cables/constants.js.map +1 -0
- package/build/dex/cables/rate-fetcher.d.ts +34 -0
- package/build/dex/cables/rate-fetcher.js +106 -0
- package/build/dex/cables/rate-fetcher.js.map +1 -0
- package/build/dex/cables/types.d.ts +113 -0
- package/build/dex/cables/types.js +19 -0
- package/build/dex/cables/types.js.map +1 -0
- package/build/dex/cables/validators.d.ts +5 -0
- package/build/dex/cables/validators.js +49 -0
- package/build/dex/cables/validators.js.map +1 -0
- package/build/dex/fluid-dex/config.js +1 -1
- package/build/dex/fluid-dex/fluid-dex-generate-pool.d.ts +49 -0
- package/build/dex/fluid-dex/fluid-dex-generate-pool.js +104 -0
- package/build/dex/fluid-dex/fluid-dex-generate-pool.js.map +1 -0
- package/build/dex/fluid-dex/fluid-dex-liquidity-proxy.js +28 -1
- package/build/dex/fluid-dex/fluid-dex-liquidity-proxy.js.map +1 -1
- package/build/dex/fluid-dex/fluid-dex.d.ts +19 -10
- package/build/dex/fluid-dex/fluid-dex.js +213 -55
- package/build/dex/fluid-dex/fluid-dex.js.map +1 -1
- package/build/dex/fluid-dex/types.d.ts +22 -2
- package/build/dex/integral/config.d.ts +4 -0
- package/build/dex/integral/config.js +20 -0
- package/build/dex/integral/config.js.map +1 -0
- package/build/dex/integral/context.d.ts +40 -0
- package/build/dex/integral/context.js +158 -0
- package/build/dex/integral/context.js.map +1 -0
- package/build/dex/integral/integral-factory.d.ts +24 -0
- package/build/dex/integral/integral-factory.js +95 -0
- package/build/dex/integral/integral-factory.js.map +1 -0
- package/build/dex/integral/integral-pool.d.ts +50 -0
- package/build/dex/integral/integral-pool.js +149 -0
- package/build/dex/integral/integral-pool.js.map +1 -0
- package/build/dex/integral/integral-pricing.d.ts +18 -0
- package/build/dex/integral/integral-pricing.js +114 -0
- package/build/dex/integral/integral-pricing.js.map +1 -0
- package/build/dex/integral/integral-relayer.d.ts +42 -0
- package/build/dex/integral/integral-relayer.js +192 -0
- package/build/dex/integral/integral-relayer.js.map +1 -0
- package/build/dex/integral/integral-token.d.ts +27 -0
- package/build/dex/integral/integral-token.js +59 -0
- package/build/dex/integral/integral-token.js.map +1 -0
- package/build/dex/integral/integral.d.ts +41 -0
- package/build/dex/integral/integral.js +376 -0
- package/build/dex/integral/integral.js.map +1 -0
- package/build/dex/integral/types.d.ts +85 -0
- package/build/dex/integral/types.js +9 -0
- package/build/dex/integral/types.js.map +1 -0
- package/build/dex/integral/utils-e2e.d.ts +9 -0
- package/build/dex/integral/utils-e2e.js +131 -0
- package/build/dex/integral/utils-e2e.js.map +1 -0
- package/build/dex/integral/utils.d.ts +17 -0
- package/build/dex/integral/utils.js +94 -0
- package/build/dex/integral/utils.js.map +1 -0
- package/build/dex/jarvis.d.ts +1 -2
- package/build/dex/jarvis.js +0 -58
- package/build/dex/jarvis.js.map +1 -1
- package/build/dex/platypus/platypus.d.ts +1 -2
- package/build/dex/platypus/platypus.js +0 -45
- package/build/dex/platypus/platypus.js.map +1 -1
- package/build/dex/stable-pool.js +8 -1
- package/build/dex/stable-pool.js.map +1 -1
- package/build/dex/swaap-v1/swaap-v1.d.ts +1 -2
- package/build/dex/swaap-v1/swaap-v1.js +0 -14
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/dex/trader-joe-v2.1/optimizer.d.ts +2 -0
- package/build/dex/trader-joe-v2.1/optimizer.js +47 -0
- package/build/dex/trader-joe-v2.1/optimizer.js.map +1 -0
- package/build/dex/zerox/index.d.ts +26 -4
- package/build/dex/zerox/index.js +42 -50
- package/build/dex/zerox/index.js.map +1 -1
- package/build/dex/zerox/types.d.ts +0 -29
- package/build/dex/zerox/types.js +1 -8
- package/build/dex/zerox/types.js.map +1 -1
- package/build/executor/Executor03BytecodeBuilder.js +8 -3
- package/build/executor/Executor03BytecodeBuilder.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/fluid-dex/resolver.abi.json +731 -4
- package/src/dex/fluid-dex/config.ts +1 -1
- package/src/dex/fluid-dex/fluid-dex-e2e.test.ts +157 -6
- package/src/dex/fluid-dex/fluid-dex-events.test.ts +2 -4
- package/src/dex/fluid-dex/fluid-dex-integration.test.ts +69 -9
- package/src/dex/fluid-dex/fluid-dex-liquidity-proxy.ts +33 -0
- package/src/dex/fluid-dex/fluid-dex.ts +311 -89
- package/src/dex/fluid-dex/types.ts +25 -1
- package/src/executor/Executor03BytecodeBuilder.ts +10 -2
- package/.vscode/launch.json +0 -53
- package/.vscode/settings.json +0 -2
- package/.vscode/tasks.json +0 -15
- package/build/abi/inception/inception-ratio-feed.json +0 -329
- package/build/abi/inception/inception-vault.json +0 -991
- package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +0 -52
- package/build/dex/aave-v2/tokens-avalanche.json +0 -44
- package/build/dex/aave-v2/tokens-mainnet.json +0 -188
- package/build/dex/aave-v2/tokens-polygon.json +0 -44
- package/build/dex/balancer-v3/abi/balancerBatchRouter.d.ts +0 -729
- package/build/dex/balancer-v3/abi/balancerBatchRouter.js +0 -732
- package/build/dex/balancer-v3/abi/balancerBatchRouter.js.map +0 -1
- package/build/dex/balancer-v3/abi/balancerRouter.d.ts +0 -1406
- package/build/dex/balancer-v3/abi/balancerRouter.js +0 -1175
- package/build/dex/balancer-v3/abi/balancerRouter.js.map +0 -1
- package/build/dex/balancer-v3/abi/vaultExtension.V3.d.ts +0 -2081
- package/build/dex/balancer-v3/abi/vaultExtension.V3.js +0 -1851
- package/build/dex/balancer-v3/abi/vaultExtension.V3.js.map +0 -1
- package/build/dex/balancer-v3/balancer-v3-pool.d.ts +0 -76
- package/build/dex/balancer-v3/balancer-v3-pool.js +0 -383
- package/build/dex/balancer-v3/balancer-v3-pool.js.map +0 -1
- package/build/dex/balancer-v3/balancer-v3.d.ts +0 -57
- package/build/dex/balancer-v3/balancer-v3.js +0 -373
- package/build/dex/balancer-v3/balancer-v3.js.map +0 -1
- package/build/dex/balancer-v3/config.d.ts +0 -8
- package/build/dex/balancer-v3/config.js +0 -24
- package/build/dex/balancer-v3/config.js.map +0 -1
- package/build/dex/balancer-v3/getOnChainState.d.ts +0 -10
- package/build/dex/balancer-v3/getOnChainState.js +0 -158
- package/build/dex/balancer-v3/getOnChainState.js.map +0 -1
- package/build/dex/balancer-v3/getPoolsApi.d.ts +0 -2
- package/build/dex/balancer-v3/getPoolsApi.js +0 -81
- package/build/dex/balancer-v3/getPoolsApi.js.map +0 -1
- package/build/dex/balancer-v3/getTopPoolsApi.d.ts +0 -13
- package/build/dex/balancer-v3/getTopPoolsApi.js +0 -62
- package/build/dex/balancer-v3/getTopPoolsApi.js.map +0 -1
- package/build/dex/balancer-v3/types.d.ts +0 -63
- package/build/dex/balancer-v3/types.js +0 -3
- package/build/dex/balancer-v3/types.js.map +0 -1
- package/build/dex/inception/config.d.ts +0 -4
- package/build/dex/inception/config.js +0 -109
- package/build/dex/inception/config.js.map +0 -1
- package/build/dex/inception/inception-event-pool.d.ts +0 -16
- package/build/dex/inception/inception-event-pool.js +0 -49
- package/build/dex/inception/inception-event-pool.js.map +0 -1
- package/build/dex/inception/inception.d.ts +0 -43
- package/build/dex/inception/inception.js +0 -180
- package/build/dex/inception/inception.js.map +0 -1
- package/build/dex/inception/tokens.d.ts +0 -9
- package/build/dex/inception/tokens.js +0 -28
- package/build/dex/inception/tokens.js.map +0 -1
- package/build/dex/inception/types.d.ts +0 -22
- package/build/dex/inception/types.js +0 -3
- package/build/dex/inception/types.js.map +0 -1
- package/build/dex/inception/utils.d.ts +0 -7
- package/build/dex/inception/utils.js +0 -58
- package/build/dex/inception/utils.js.map +0 -1
- package/build/dex/maker-psm/scripts/gem.abi.json +0 -136
- package/build/dex/maker-psm/scripts/validate-state.d.ts +0 -0
- package/build/dex/maker-psm/scripts/validate-state.js +0 -185
- package/build/dex/maker-psm/scripts/validate-state.js.map +0 -1
- package/build/dex/maker-psm/scripts/vat.abi.json +0 -243
- package/build/dex/solidly-v3/scripts/check-event-pool-event.d.ts +0 -1
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js +0 -53
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +0 -1
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +0 -17
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +0 -64
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +0 -1
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +0 -17
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +0 -79
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +0 -1
- package/build/dex/uniswap-v3/uniswap-v3-pricing.d.ts +0 -4
- package/build/dex/uniswap-v3/uniswap-v3-pricing.js +0 -43
- package/build/dex/uniswap-v3/uniswap-v3-pricing.js.map +0 -1
- package/build/dex/uniswap-v3/uniswap-v3-worker.d.ts +0 -1
- package/build/dex/uniswap-v3/uniswap-v3-worker.js +0 -10
- package/build/dex/uniswap-v3/uniswap-v3-worker.js.map +0 -1
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getPoolsApi = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const config_1 = require("./config");
|
|
9
|
-
const utils_1 = require("ethers/lib/utils");
|
|
10
|
-
function createQuery(networkId, poolTypes, timestamp) {
|
|
11
|
-
const poolTypesString = poolTypes.map(type => `${type}`).join(', ');
|
|
12
|
-
const networkString = config_1.BalancerV3Config.BalancerV3[networkId].apiNetworkName;
|
|
13
|
-
// Build the where clause conditionally
|
|
14
|
-
const whereClause = {
|
|
15
|
-
chainIn: networkString,
|
|
16
|
-
protocolVersionIn: 3,
|
|
17
|
-
hasHook: false,
|
|
18
|
-
poolTypeIn: `[${poolTypesString}]`,
|
|
19
|
-
...(timestamp && { createTime: `{lt: ${timestamp}}` }),
|
|
20
|
-
};
|
|
21
|
-
// Convert where clause to string, filtering out undefined values
|
|
22
|
-
const whereString = Object.entries(whereClause)
|
|
23
|
-
.map(([key, value]) => `${key}: ${value}`)
|
|
24
|
-
.join(', ');
|
|
25
|
-
return `
|
|
26
|
-
query MyQuery {
|
|
27
|
-
poolGetAggregatorPools(
|
|
28
|
-
where: {${whereString}}
|
|
29
|
-
) {
|
|
30
|
-
id
|
|
31
|
-
type
|
|
32
|
-
poolTokens {
|
|
33
|
-
address
|
|
34
|
-
weight
|
|
35
|
-
isErc4626
|
|
36
|
-
underlyingToken {
|
|
37
|
-
address
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
`;
|
|
43
|
-
}
|
|
44
|
-
function toImmutablePoolStateMap(pools) {
|
|
45
|
-
return pools.reduce((map, pool) => {
|
|
46
|
-
const immutablePoolState = {
|
|
47
|
-
address: pool.id,
|
|
48
|
-
tokens: pool.poolTokens.map(t => t.address),
|
|
49
|
-
tokensUnderlying: pool.poolTokens.map(t => t.underlyingToken ? t.underlyingToken.address : null),
|
|
50
|
-
weights: pool.poolTokens.map(t => t.weight ? (0, utils_1.parseUnits)(t.weight, 18).toBigInt() : 0n),
|
|
51
|
-
poolType: pool.type,
|
|
52
|
-
// TODO add scalingFactors once API provides them
|
|
53
|
-
// scalingFactors: pool.poolTokens.map(t => parseUnits('1', 18).toBigInt()),
|
|
54
|
-
// TODO Hook support will be added in future PR
|
|
55
|
-
hookType: undefined,
|
|
56
|
-
};
|
|
57
|
-
map[pool.id] = immutablePoolState;
|
|
58
|
-
return map;
|
|
59
|
-
}, {});
|
|
60
|
-
}
|
|
61
|
-
// Any data from API will be immutable. Mutable data such as balances, etc will be fetched via onchain/event state.
|
|
62
|
-
async function getPoolsApi(network, timestamp) {
|
|
63
|
-
try {
|
|
64
|
-
const query = createQuery(network, Object.values(config_1.SUPPORTED_POOLS), timestamp);
|
|
65
|
-
const response = await axios_1.default.post(config_1.apiUrl, {
|
|
66
|
-
query,
|
|
67
|
-
}, {
|
|
68
|
-
headers: {
|
|
69
|
-
'Content-Type': 'application/json',
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
const pools = response.data.data.poolGetAggregatorPools;
|
|
73
|
-
return toImmutablePoolStateMap(pools);
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
// console.error('Error executing GraphQL query:', error);
|
|
77
|
-
throw error;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
exports.getPoolsApi = getPoolsApi;
|
|
81
|
-
//# sourceM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CA4BC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
interface PoolToken {
|
|
2
|
-
address: string;
|
|
3
|
-
decimals: number;
|
|
4
|
-
}
|
|
5
|
-
interface Pool {
|
|
6
|
-
address: string;
|
|
7
|
-
poolTokens: PoolToken[];
|
|
8
|
-
dynamicData: {
|
|
9
|
-
totalLiquidity: string;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export declare function getTopPoolsApi(networkId: number, poolsFilter: string[], count: number): Promise<Pool[]>;
|
|
13
|
-
export {};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getTopPoolsApi = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const config_1 = require("./config");
|
|
9
|
-
function createQuery(networkId, poolsFilter, count) {
|
|
10
|
-
const networkString = config_1.BalancerV3Config.BalancerV3[networkId].apiNetworkName;
|
|
11
|
-
const poolIdString = poolsFilter.map(a => `"${a}"`).join(', ');
|
|
12
|
-
// Build the where clause conditionally
|
|
13
|
-
const whereClause = {
|
|
14
|
-
chainIn: networkString,
|
|
15
|
-
protocolVersionIn: 3,
|
|
16
|
-
hasHook: false,
|
|
17
|
-
idIn: `[${poolIdString}]`,
|
|
18
|
-
};
|
|
19
|
-
// Convert where clause to string, filtering out undefined values
|
|
20
|
-
const whereString = Object.entries(whereClause)
|
|
21
|
-
.map(([key, value]) => `${key}: ${value}`)
|
|
22
|
-
.join(', ');
|
|
23
|
-
return `
|
|
24
|
-
query MyQuery {
|
|
25
|
-
poolGetAggregatorPools(
|
|
26
|
-
where: {${whereString}}
|
|
27
|
-
first: ${count}
|
|
28
|
-
orderBy: totalLiquidity
|
|
29
|
-
orderDirection: desc
|
|
30
|
-
) {
|
|
31
|
-
address
|
|
32
|
-
poolTokens {
|
|
33
|
-
address
|
|
34
|
-
decimals
|
|
35
|
-
}
|
|
36
|
-
dynamicData {
|
|
37
|
-
totalLiquidity
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
`;
|
|
42
|
-
}
|
|
43
|
-
async function getTopPoolsApi(networkId, poolsFilter, count) {
|
|
44
|
-
try {
|
|
45
|
-
const query = createQuery(networkId, poolsFilter, count);
|
|
46
|
-
const response = await axios_1.default.post(config_1.apiUrl, {
|
|
47
|
-
query,
|
|
48
|
-
}, {
|
|
49
|
-
headers: {
|
|
50
|
-
'Content-Type': 'application/json',
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
const pools = response.data.data.poolGetAggregatorPools;
|
|
54
|
-
return pools;
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
// console.error('Error executing GraphQL query:', error);
|
|
58
|
-
throw error;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
exports.getTopPoolsApi = getTopPoolsApi;
|
|
62
|
-
//# sourceMappingURL=getTopPoolsApi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getTopPoolsApi.js","sourceRoot":"","sources":["../../../src/dex/balancer-v3/getTopPoolsApi.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,qCAAoD;AAqBpD,SAAS,WAAW,CAClB,SAAiB,EACjB,WAAqB,EACrB,KAAa;IAEb,MAAM,aAAa,GAAG,yBAAgB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC;IAC5E,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,uCAAuC;IACvC,MAAM,WAAW,GAAG;QAClB,OAAO,EAAE,aAAa;QACtB,iBAAiB,EAAE,CAAC;QACpB,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,IAAI,YAAY,GAAG;KAC1B,CAAC;IAEF,iEAAiE;IACjE,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC;SAC5C,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,KAAK,EAAE,CAAC;SACzC,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,OAAO;;;kBAGS,WAAW;iBACZ,KAAK;;;;;;;;;;;;;;GAcnB,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,cAAc,CAClC,SAAiB,EACjB,WAAqB,EACrB,KAAa;IAEb,IAAI;QACF,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;QACzD,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,IAAI,CAC/B,eAAM,EACN;YACE,KAAK;SACN,EACD;YACE,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;SACF,CACF,CAAC;QAEF,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC;QACxD,OAAO,KAAK,CAAC;KACd;IAAC,OAAO,KAAK,EAAE;QACd,0DAA0D;QAC1D,MAAM,KAAK,CAAC;KACb;AACH,CAAC;AAzBD,wCAyBC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { BufferState } from '@balancer-labs/balancer-maths';
|
|
2
|
-
import { Address } from '../../types';
|
|
3
|
-
export declare type CommonImmutablePoolState = {
|
|
4
|
-
address: string;
|
|
5
|
-
poolType: string;
|
|
6
|
-
tokens: string[];
|
|
7
|
-
tokensUnderlying: (string | null)[];
|
|
8
|
-
weights: bigint[];
|
|
9
|
-
hookType: string | undefined;
|
|
10
|
-
};
|
|
11
|
-
export interface CommonMutableState {
|
|
12
|
-
tokenRates: bigint[];
|
|
13
|
-
balancesLiveScaled18: bigint[];
|
|
14
|
-
swapFee: bigint;
|
|
15
|
-
aggregateSwapFee: bigint;
|
|
16
|
-
totalSupply: bigint;
|
|
17
|
-
isPoolPaused: boolean;
|
|
18
|
-
scalingFactors: bigint[];
|
|
19
|
-
hasHook: boolean;
|
|
20
|
-
}
|
|
21
|
-
declare type CommonPoolState = CommonImmutablePoolState & CommonMutableState;
|
|
22
|
-
export declare type PoolState = CommonPoolState | (CommonPoolState & StableMutableState);
|
|
23
|
-
export interface StableMutableState {
|
|
24
|
-
amp: bigint;
|
|
25
|
-
ampIsUpdating: boolean;
|
|
26
|
-
ampStartValue: bigint;
|
|
27
|
-
ampEndValue: bigint;
|
|
28
|
-
ampStartTime: bigint;
|
|
29
|
-
ampStopTime: bigint;
|
|
30
|
-
}
|
|
31
|
-
export declare type PoolStateMap = {
|
|
32
|
-
[address: string]: PoolState;
|
|
33
|
-
};
|
|
34
|
-
export declare type ImmutablePoolStateMap = {
|
|
35
|
-
[address: string]: CommonImmutablePoolState;
|
|
36
|
-
};
|
|
37
|
-
export declare type Step = {
|
|
38
|
-
pool: Address;
|
|
39
|
-
tokenOut: Address;
|
|
40
|
-
isBuffer: boolean;
|
|
41
|
-
swapInput: {
|
|
42
|
-
tokenIn: Address;
|
|
43
|
-
tokenOut: Address;
|
|
44
|
-
};
|
|
45
|
-
poolState: PoolState | BufferState;
|
|
46
|
-
};
|
|
47
|
-
export declare type BalancerV3Data = {
|
|
48
|
-
steps: Step[];
|
|
49
|
-
};
|
|
50
|
-
export declare type DexParams = {
|
|
51
|
-
apiNetworkName: string;
|
|
52
|
-
vaultAddress: string;
|
|
53
|
-
balancerRouterAddress: string;
|
|
54
|
-
balancerBatchRouterAddress: string;
|
|
55
|
-
};
|
|
56
|
-
export declare type TokenInfo = {
|
|
57
|
-
isBoosted: boolean;
|
|
58
|
-
underlyingToken: string | null;
|
|
59
|
-
mainToken: string;
|
|
60
|
-
index: number;
|
|
61
|
-
rate: bigint;
|
|
62
|
-
};
|
|
63
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/balancer-v3/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InceptionPricePoolConfig = exports.InceptionConfig = void 0;
|
|
4
|
-
const constants_1 = require("../../constants");
|
|
5
|
-
exports.InceptionConfig = {
|
|
6
|
-
InceptionLRT: {
|
|
7
|
-
[constants_1.Network.MAINNET]: [
|
|
8
|
-
{
|
|
9
|
-
symbol: 'instETH',
|
|
10
|
-
token: '0x7FA768E035F956c41d6aeaa3Bd857e7E5141CAd5',
|
|
11
|
-
vault: '0x814CC6B8fd2555845541FB843f37418b05977d8d',
|
|
12
|
-
baseToken: '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84',
|
|
13
|
-
baseTokenSlug: 'STETH',
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
symbol: 'inrETH',
|
|
17
|
-
token: '0x80d69e79258FE9D056c822461c4eb0B4ca8802E2',
|
|
18
|
-
vault: '0x1Aa53BC4Beb82aDf7f5EDEE9e3bBF3434aD59F12',
|
|
19
|
-
baseToken: '0xae78736Cd615f374D3085123A210448E74Fc6393',
|
|
20
|
-
baseTokenSlug: 'rETH',
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
symbol: 'inoETH',
|
|
24
|
-
token: '0x9181f633e9b9f15a32d5e37094f4c93b333e0e92',
|
|
25
|
-
vault: '0x4878F636A9Aa314B776Ac51A25021C44CAF86bEd',
|
|
26
|
-
baseToken: '0x856c4Efb76C1D1AE02e20CEB03A2A6a08b0b8dC3',
|
|
27
|
-
baseTokenSlug: 'oETH',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
symbol: 'inosETH',
|
|
31
|
-
token: '0xfD07fD5EBEa6F24888a397997E262179Bf494336',
|
|
32
|
-
vault: '0xA9F8c770661BeE8DF2D026edB1Cb6FF763C780FF',
|
|
33
|
-
baseToken: '0xf1C9acDc66974dFB6dEcB12aA385b9cD01190E38',
|
|
34
|
-
baseTokenSlug: 'osETH',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
symbol: 'inankrETH',
|
|
38
|
-
token: '0xfa2629B9cF3998D52726994E0FcdB750224D8B9D',
|
|
39
|
-
vault: '0x36B429439AB227fAB170A4dFb3321741c8815e55',
|
|
40
|
-
baseToken: '0xE95A203B1a91a908F9B9CE46459d101078c2c3cb',
|
|
41
|
-
baseTokenSlug: 'AnkETH',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
symbol: 'incbETH',
|
|
45
|
-
token: '0xbf19eead55a6b100667f04f8fbc5371e03e8ab2e',
|
|
46
|
-
vault: '0xfE715358368416E01d3A961D3a037b7359735d5e',
|
|
47
|
-
baseToken: '0xBe9895146f7AF43049ca1c1AE358B0541Ea49704',
|
|
48
|
-
baseTokenSlug: 'cbETH',
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
symbol: 'inwbETH',
|
|
52
|
-
token: '0xda9b11cd701e10c2ec1a284f80820edd128c5246',
|
|
53
|
-
vault: '0xC0660932C5dCaD4A1409b7975d147203B1e9A2B6',
|
|
54
|
-
baseToken: '0xa2E3356610840701BDf5611a53974510Ae27E2e1',
|
|
55
|
-
baseTokenSlug: 'wbETH',
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
symbol: 'inswETH',
|
|
59
|
-
token: '0xc3ade5ace1bbb033ccae8177c12ecbfa16bd6a9d',
|
|
60
|
-
vault: '0xc4181dC7BB31453C4A48689ce0CBe975e495321c',
|
|
61
|
-
baseToken: '0xf951E335afb289353dc249e82926178EaC7DEd78',
|
|
62
|
-
baseTokenSlug: 'SWETH',
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
symbol: 'inETHx',
|
|
66
|
-
token: '0x57a5a0567187ff4a8dcc1a9bba86155e355878f2',
|
|
67
|
-
vault: '0x90E80E25ABDB6205B08DeBa29a87f7eb039023C2',
|
|
68
|
-
baseToken: '0xA35b1B31Ce002FBF2058D22F30f95D405200A15b',
|
|
69
|
-
baseTokenSlug: 'ETHx',
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
symbol: 'insfrxETH',
|
|
73
|
-
token: '0x668308d77be3533c909a692302cb4d135bf8041c',
|
|
74
|
-
vault: '0x295234B7E370a5Db2D2447aCA83bc7448f151161',
|
|
75
|
-
baseToken: '0xac3E018457B222d93114458476f3E3416Abbe38F',
|
|
76
|
-
baseTokenSlug: 'sfrxETH',
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
symbol: 'inmETH',
|
|
80
|
-
token: '0xeCf3672A6d2147E2A77f07069Fb48d8Cf6F6Fbf9',
|
|
81
|
-
vault: '0xd0ee89d82183D7Ddaef14C6b4fC0AA742F426355',
|
|
82
|
-
baseToken: '0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa',
|
|
83
|
-
baseTokenSlug: 'mETH',
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
symbol: 'inlsETH',
|
|
87
|
-
token: '0x94b888e11a9e960a9c3b3528eb6ac807b27ca62e',
|
|
88
|
-
vault: '0x6E17a8b5D33e6DBdB9fC61d758BF554b6AD93322',
|
|
89
|
-
baseToken: '0x8c1BEd5b9a0928467c9B1341Da1D7BD5e10b6549',
|
|
90
|
-
baseTokenSlug: 'lsETH',
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
symbol: 'inETH',
|
|
94
|
-
token: '0xf073bAC22DAb7FaF4a3Dd6c6189a70D54110525C',
|
|
95
|
-
vault: '0x46199cAa0e453971cedf97f926368d9E5415831a',
|
|
96
|
-
baseToken: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
|
|
97
|
-
baseTokenSlug: 'ETH',
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
exports.InceptionPricePoolConfig = {
|
|
103
|
-
InceptionLRT: {
|
|
104
|
-
[constants_1.Network.MAINNET]: {
|
|
105
|
-
ratioFeed: '0xFd73Be536503B5Aa80Bf99D1Fd65b1306c69B191',
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/inception/config.ts"],"names":[],"mappings":";;;AAEA,+CAA0C;AAE7B,QAAA,eAAe,GAA8B;IACxD,YAAY,EAAE;QACZ,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB;gBACE,MAAM,EAAE,SAAS;gBACjB,KAAK,EAAE,4CAA4C;gBACnD,KAAK,EAAE,4CAA4C;gBACnD,SAAS,EAAE,4CAA4C;gBACvD,aAAa,EAAE,OAAO;aACvB;YACD;gBACE,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,4CAA4C;gBACnD,KAAK,EAAE,4CAA4C;gBACnD,SAAS,EAAE,4CAA4C;gBACvD,aAAa,EAAE,MAAM;aACtB;YACD;gBACE,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,4CAA4C;gBACnD,KAAK,EAAE,4CAA4C;gBACnD,SAAS,EAAE,4CAA4C;gBACvD,aAAa,EAAE,MAAM;aACtB;YACD;gBACE,MAAM,EAAE,SAAS;gBACjB,KAAK,EAAE,4CAA4C;gBACnD,KAAK,EAAE,4CAA4C;gBACnD,SAAS,EAAE,4CAA4C;gBACvD,aAAa,EAAE,OAAO;aACvB;YACD;gBACE,MAAM,EAAE,WAAW;gBACnB,KAAK,EAAE,4CAA4C;gBACnD,KAAK,EAAE,4CAA4C;gBACnD,SAAS,EAAE,4CAA4C;gBACvD,aAAa,EAAE,QAAQ;aACxB;YACD;gBACE,MAAM,EAAE,SAAS;gBACjB,KAAK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,4CAA4C;SACxD;KACF;CACF,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { AsyncOrSync, DeepReadonly } from 'ts-essentials';
|
|
2
|
-
import { BlockHeader, Log, Logger } from '../../types';
|
|
3
|
-
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
4
|
-
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
5
|
-
import { PoolConfig, PoolState } from './types';
|
|
6
|
-
import { Interface } from '@ethersproject/abi';
|
|
7
|
-
export declare class InceptionEventPool extends StatefulEventSubscriber<PoolState> {
|
|
8
|
-
protected network: number;
|
|
9
|
-
protected dexHelper: IDexHelper;
|
|
10
|
-
poolConfig: PoolConfig;
|
|
11
|
-
poolInterface: Interface;
|
|
12
|
-
protected ratioFeedInterface: Interface;
|
|
13
|
-
constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, poolConfig: PoolConfig, poolInterface: Interface);
|
|
14
|
-
protected processLog(state: DeepReadonly<PoolState>, log: Readonly<Log>, blockHeader: Readonly<BlockHeader>): AsyncOrSync<DeepReadonly<PoolState> | null>;
|
|
15
|
-
generateState(blockNumber: number): Promise<Readonly<PoolState>>;
|
|
16
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.InceptionEventPool = void 0;
|
|
7
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
-
const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
|
|
9
|
-
const utils_1 = require("./utils");
|
|
10
|
-
const abi_1 = require("@ethersproject/abi");
|
|
11
|
-
const inception_ratio_feed_json_1 = __importDefault(require("../../abi/inception/inception-ratio-feed.json"));
|
|
12
|
-
const tokens_1 = require("./tokens");
|
|
13
|
-
class InceptionEventPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
14
|
-
constructor(parentName, network, dexHelper, logger, poolConfig, poolInterface) {
|
|
15
|
-
super(parentName, poolConfig.ratioFeedAddress, dexHelper, logger);
|
|
16
|
-
this.network = network;
|
|
17
|
-
this.dexHelper = dexHelper;
|
|
18
|
-
this.poolConfig = poolConfig;
|
|
19
|
-
this.poolInterface = poolInterface;
|
|
20
|
-
this.ratioFeedInterface = new abi_1.Interface(inception_ratio_feed_json_1.default);
|
|
21
|
-
this.addressesSubscribed = [poolConfig.ratioFeedAddress];
|
|
22
|
-
}
|
|
23
|
-
processLog(state, log, blockHeader) {
|
|
24
|
-
try {
|
|
25
|
-
const parsed = this.ratioFeedInterface.parseLog(log);
|
|
26
|
-
const _state = lodash_1.default.cloneDeep(state);
|
|
27
|
-
switch (parsed.name) {
|
|
28
|
-
case 'RatioUpdated': {
|
|
29
|
-
const tokenInfo = (0, tokens_1.getTokenFromAddress)(this.network, parsed.args[0]);
|
|
30
|
-
_state[tokenInfo.symbol.toLowerCase()] = {
|
|
31
|
-
ratio: BigInt(parsed.args[2].toString()),
|
|
32
|
-
};
|
|
33
|
-
return _state;
|
|
34
|
-
}
|
|
35
|
-
default:
|
|
36
|
-
return _state;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
catch (e) {
|
|
40
|
-
this.logger.error('Failed to parse log', e);
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
async generateState(blockNumber) {
|
|
45
|
-
return (0, utils_1.getOnChainState)(this.dexHelper.multiContract, this.poolInterface, this.network, blockNumber);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.InceptionEventPool = InceptionEventPool;
|
|
49
|
-
//# sourceMappingURL=inception-event-pool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inception-event-pool.js","sourceRoot":"","sources":["../../../src/dex/inception/inception-event-pool.ts"],"names":[],"mappings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,EAAE;YACV,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC;YAC5C,OAAO,IAAI,CAAC;SACb;IACH,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,WAAmB;QACrC,OAAO,IAAA,uBAAe,EACpB,IAAI,CAAC,SAAS,CAAC,aAAa,EAC5B,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,OAAO,EACZ,WAAW,CACZ,CAAC;IACJ,CAAC;CACF;AAhDD,gDAgDC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Interface } from '@ethersproject/abi';
|
|
2
|
-
import { AsyncOrSync } from 'ts-essentials';
|
|
3
|
-
import { NumberAsString, SwapSide } from '@paraswap/core';
|
|
4
|
-
import { AdapterExchangeParam, Address, DexExchangeParam, ExchangePrices, Logger, PoolLiquidity, PoolPrices, Token } from '../../types';
|
|
5
|
-
import { Network } from '../../constants';
|
|
6
|
-
import { IDex } from '../../dex/idex';
|
|
7
|
-
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
8
|
-
import { DexParams, InceptionDexData, PoolState } from './types';
|
|
9
|
-
import { SimpleExchange } from '../simple-exchange';
|
|
10
|
-
import { InceptionEventPool } from './inception-event-pool';
|
|
11
|
-
export declare class Inception extends SimpleExchange implements IDex<InceptionDexData> {
|
|
12
|
-
readonly network: Network;
|
|
13
|
-
readonly dexKey: string;
|
|
14
|
-
readonly dexHelper: IDexHelper;
|
|
15
|
-
protected config: DexParams[];
|
|
16
|
-
protected vaultInterface: Interface;
|
|
17
|
-
protected poolInterface: Interface;
|
|
18
|
-
readonly hasConstantPriceLargeAmounts = false;
|
|
19
|
-
readonly needWrapNative = false;
|
|
20
|
-
readonly isFeeOnTransferSupported = false;
|
|
21
|
-
static dexKeysWithNetwork: {
|
|
22
|
-
key: string;
|
|
23
|
-
networks: Network[];
|
|
24
|
-
}[];
|
|
25
|
-
logger: Logger;
|
|
26
|
-
private eventPool;
|
|
27
|
-
constructor(network: Network, dexKey: string, dexHelper: IDexHelper, config?: DexParams[]);
|
|
28
|
-
initializePricing(blockNumber: number): Promise<void>;
|
|
29
|
-
initializeTokens(): Promise<void>;
|
|
30
|
-
getAdapters(side: SwapSide): {
|
|
31
|
-
name: string;
|
|
32
|
-
index: number;
|
|
33
|
-
}[] | null;
|
|
34
|
-
getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
|
|
35
|
-
getPoolState(pool: InceptionEventPool, blockNumber: number): Promise<PoolState>;
|
|
36
|
-
getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<InceptionDexData>>;
|
|
37
|
-
getCalldataGasCost(poolPrices: PoolPrices<InceptionDexData>): number | number[];
|
|
38
|
-
getAdapterParam(): AdapterExchangeParam;
|
|
39
|
-
getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: InceptionDexData, side: SwapSide): DexExchangeParam;
|
|
40
|
-
updatePoolState(): Promise<void>;
|
|
41
|
-
getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
|
|
42
|
-
releaseResources(): AsyncOrSync<void>;
|
|
43
|
-
}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.Inception = void 0;
|
|
30
|
-
const abi_1 = require("@ethersproject/abi");
|
|
31
|
-
const core_1 = require("@paraswap/core");
|
|
32
|
-
const inception_vault_json_1 = __importDefault(require("../../abi/inception/inception-vault.json"));
|
|
33
|
-
const inception_ineth_pool_json_1 = __importDefault(require("../../abi/inception/inception-ineth-pool.json"));
|
|
34
|
-
const constants_1 = require("../../constants");
|
|
35
|
-
const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
|
|
36
|
-
const utils_1 = require("../../utils");
|
|
37
|
-
const simple_exchange_1 = require("../simple-exchange");
|
|
38
|
-
const config_1 = require("./config");
|
|
39
|
-
const tokens_1 = require("./tokens");
|
|
40
|
-
const utils_2 = require("./utils");
|
|
41
|
-
const inception_event_pool_1 = require("./inception-event-pool");
|
|
42
|
-
const DECIMALS = BigInt(1e18);
|
|
43
|
-
class Inception extends simple_exchange_1.SimpleExchange {
|
|
44
|
-
constructor(network, dexKey, dexHelper, config = config_1.InceptionConfig[dexKey][network]) {
|
|
45
|
-
super(dexHelper, dexKey);
|
|
46
|
-
this.network = network;
|
|
47
|
-
this.dexKey = dexKey;
|
|
48
|
-
this.dexHelper = dexHelper;
|
|
49
|
-
this.config = config;
|
|
50
|
-
this.hasConstantPriceLargeAmounts = false;
|
|
51
|
-
this.needWrapNative = false;
|
|
52
|
-
this.isFeeOnTransferSupported = false;
|
|
53
|
-
this.logger = dexHelper.getLogger(dexKey);
|
|
54
|
-
this.vaultInterface = new abi_1.Interface(inception_vault_json_1.default);
|
|
55
|
-
this.poolInterface = new abi_1.Interface(inception_ineth_pool_json_1.default);
|
|
56
|
-
this.eventPool = new inception_event_pool_1.InceptionEventPool(dexKey, network, dexHelper, this.logger, {
|
|
57
|
-
ratioFeedAddress: config_1.InceptionPricePoolConfig[dexKey][network].ratioFeed,
|
|
58
|
-
initState: {},
|
|
59
|
-
}, this.poolInterface);
|
|
60
|
-
}
|
|
61
|
-
async initializePricing(blockNumber) {
|
|
62
|
-
const poolState = await (0, utils_2.getOnChainState)(this.dexHelper.multiContract, this.vaultInterface, this.network, blockNumber);
|
|
63
|
-
await this.eventPool.initialize(blockNumber, {
|
|
64
|
-
state: poolState,
|
|
65
|
-
});
|
|
66
|
-
await this.initializeTokens();
|
|
67
|
-
}
|
|
68
|
-
async initializeTokens() {
|
|
69
|
-
let tokenList = await (0, utils_2.getTokenList)(this.network);
|
|
70
|
-
(0, tokens_1.setTokensOnNetwork)(this.network, tokenList);
|
|
71
|
-
}
|
|
72
|
-
getAdapters(side) {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
|
|
76
|
-
return [
|
|
77
|
-
this.dexKey +
|
|
78
|
-
'-' +
|
|
79
|
-
[srcToken.address.toLowerCase(), destToken.address.toLowerCase()]
|
|
80
|
-
.sort((a, b) => (a > b ? 1 : -1))
|
|
81
|
-
.join('_'),
|
|
82
|
-
];
|
|
83
|
-
}
|
|
84
|
-
async getPoolState(pool, blockNumber) {
|
|
85
|
-
const eventState = pool.getState(blockNumber);
|
|
86
|
-
if (eventState)
|
|
87
|
-
return eventState;
|
|
88
|
-
const onChainState = await pool.generateState(blockNumber);
|
|
89
|
-
pool.setState(onChainState, blockNumber);
|
|
90
|
-
return onChainState;
|
|
91
|
-
}
|
|
92
|
-
async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
|
|
93
|
-
if (side === core_1.SwapSide.BUY) {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
const src = (0, tokens_1.getTokenFromAddress)(this.network, srcToken.address);
|
|
97
|
-
const dest = (0, tokens_1.getTokenFromAddress)(this.network, destToken.address);
|
|
98
|
-
if (src !== dest) {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
const poolState = await this.getPoolState(this.eventPool, blockNumber);
|
|
102
|
-
if (!poolState)
|
|
103
|
-
return null;
|
|
104
|
-
return [
|
|
105
|
-
{
|
|
106
|
-
prices: amounts.map(amount => {
|
|
107
|
-
const ratio = poolState[src.symbol.toLowerCase()].ratio;
|
|
108
|
-
return (ratio * amount) / DECIMALS;
|
|
109
|
-
}),
|
|
110
|
-
unit: DECIMALS,
|
|
111
|
-
gasCost: 120000,
|
|
112
|
-
exchange: this.dexKey,
|
|
113
|
-
data: {
|
|
114
|
-
exchange: dest.vault,
|
|
115
|
-
},
|
|
116
|
-
poolAddresses: [src.token.toLowerCase()],
|
|
117
|
-
},
|
|
118
|
-
];
|
|
119
|
-
}
|
|
120
|
-
getCalldataGasCost(poolPrices) {
|
|
121
|
-
return CALLDATA_GAS_COST.DEX_OVERHEAD + CALLDATA_GAS_COST.LENGTH_SMALL;
|
|
122
|
-
}
|
|
123
|
-
getAdapterParam() {
|
|
124
|
-
return {
|
|
125
|
-
targetExchange: constants_1.NULL_ADDRESS,
|
|
126
|
-
payload: '0x',
|
|
127
|
-
networkFee: '0',
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
|
|
131
|
-
const dexParams = (0, tokens_1.getTokenFromAddress)(this.network, srcToken);
|
|
132
|
-
const isNative = dexParams.baseTokenSlug === 'ETH';
|
|
133
|
-
let swapData;
|
|
134
|
-
let dexFuncHasRecipient;
|
|
135
|
-
if (isNative) {
|
|
136
|
-
swapData = this.poolInterface.encodeFunctionData('stake()', []);
|
|
137
|
-
dexFuncHasRecipient = false;
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
swapData = this.vaultInterface.encodeFunctionData('deposit', [
|
|
141
|
-
srcAmount,
|
|
142
|
-
recipient,
|
|
143
|
-
]);
|
|
144
|
-
dexFuncHasRecipient = true;
|
|
145
|
-
}
|
|
146
|
-
return {
|
|
147
|
-
needWrapNative: false,
|
|
148
|
-
dexFuncHasRecipient,
|
|
149
|
-
exchangeData: swapData,
|
|
150
|
-
targetExchange: dexParams.vault,
|
|
151
|
-
swappedAmountNotPresentInExchangeData: true,
|
|
152
|
-
returnAmountPos: undefined,
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
async updatePoolState() { }
|
|
156
|
-
async getTopPoolsForToken(tokenAddress, limit) {
|
|
157
|
-
await this.initializeTokens();
|
|
158
|
-
const token = (0, tokens_1.getTokenFromAddress)(this.network, tokenAddress);
|
|
159
|
-
if (token) {
|
|
160
|
-
return [
|
|
161
|
-
{
|
|
162
|
-
liquidityUSD: 1e9,
|
|
163
|
-
exchange: this.dexKey,
|
|
164
|
-
address: token.vault,
|
|
165
|
-
connectorTokens: [
|
|
166
|
-
{
|
|
167
|
-
address: token.token,
|
|
168
|
-
decimals: 1e18,
|
|
169
|
-
},
|
|
170
|
-
],
|
|
171
|
-
},
|
|
172
|
-
];
|
|
173
|
-
}
|
|
174
|
-
return [];
|
|
175
|
-
}
|
|
176
|
-
releaseResources() { }
|
|
177
|
-
}
|
|
178
|
-
exports.Inception = Inception;
|
|
179
|
-
Inception.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.InceptionConfig);
|
|
180
|
-
//# sourceMappingURL=inception.js.map
|