@paraswap/dex-lib 3.8.13 → 3.8.15
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/.vscode/launch.json +16 -0
- package/.vscode/settings.json +3 -0
- package/build/abi/Uncompressor.json +250 -0
- package/build/abi/concentrator/arUSD5115.json +1746 -0
- package/build/abi/fx-protocol/FxMarket.json +1284 -0
- package/build/abi/fx-protocol/weETHOralce.json +676 -0
- package/build/abi/integral/factory.json +333 -0
- package/build/abi/integral/oracle.json +501 -0
- package/build/abi/{inception/inception-ineth-pool.json → integral/pool.json} +522 -543
- package/build/abi/integral/relayer.json +1536 -0
- package/build/abi/maverick-v2/MaverickV2Router.json +778 -0
- package/build/dex/aave-v1/aave-v1.d.ts +1 -2
- package/build/dex/aave-v1/aave-v1.js +0 -22
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/bProtocol.d.ts +18 -0
- package/build/dex/bProtocol.js +39 -0
- package/build/dex/bProtocol.js.map +1 -0
- package/build/dex/bancor.d.ts +26 -0
- package/build/dex/bancor.js +58 -0
- package/build/dex/bancor.js.map +1 -0
- package/build/dex/compound.d.ts +18 -0
- package/build/dex/compound.js +46 -0
- package/build/dex/compound.js.map +1 -0
- package/build/dex/concentrator-arusd/concentrator-arusd-event.d.ts +17 -0
- package/build/dex/concentrator-arusd/concentrator-arusd-event.js +66 -0
- package/build/dex/concentrator-arusd/concentrator-arusd-event.js.map +1 -0
- package/build/dex/concentrator-arusd/concentrator-arusd.d.ts +6 -3
- package/build/dex/concentrator-arusd/concentrator-arusd.js +45 -41
- package/build/dex/concentrator-arusd/concentrator-arusd.js.map +1 -1
- package/build/dex/concentrator-arusd/config.d.ts +1 -2
- package/build/dex/concentrator-arusd/config.js +2 -6
- package/build/dex/concentrator-arusd/config.js.map +1 -1
- package/build/dex/concentrator-arusd/types.d.ts +7 -3
- package/build/dex/concentrator-arusd/utils.d.ts +4 -0
- package/build/dex/concentrator-arusd/utils.js +27 -0
- package/build/dex/concentrator-arusd/utils.js.map +1 -0
- package/build/dex/curve-v2.d.ts +58 -0
- package/build/dex/curve-v2.js +180 -0
- package/build/dex/curve-v2.js.map +1 -0
- package/build/dex/dodo-v1.d.ts +33 -0
- package/build/dex/dodo-v1.js +63 -0
- package/build/dex/dodo-v1.js.map +1 -0
- package/build/dex/etherfi/etherfi.d.ts +26 -0
- package/build/dex/etherfi/etherfi.js +96 -0
- package/build/dex/etherfi/etherfi.js.map +1 -0
- package/build/dex/fx-protocol-rusd/config.d.ts +1 -2
- package/build/dex/fx-protocol-rusd/config.js +3 -6
- package/build/dex/fx-protocol-rusd/config.js.map +1 -1
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd-event.d.ts +18 -0
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd-event.js +71 -0
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd-event.js.map +1 -0
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd.d.ts +10 -10
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd.js +75 -70
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd.js.map +1 -1
- package/build/dex/fx-protocol-rusd/types.d.ts +6 -3
- package/build/dex/fx-protocol-rusd/utils.d.ts +4 -0
- package/build/dex/fx-protocol-rusd/utils.js +26 -0
- package/build/dex/fx-protocol-rusd/utils.js.map +1 -0
- package/build/dex/index.js +4 -0
- package/build/dex/index.js.map +1 -1
- package/build/dex/{infusion → integral}/config.d.ts +1 -1
- 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/helpers.d.ts +17 -0
- package/build/dex/integral/helpers.js +157 -0
- package/build/dex/integral/helpers.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/{inception/inception-native.d.ts → integral/integral.d.ts} +19 -21
- package/build/dex/integral/integral.js +377 -0
- package/build/dex/integral/integral.js.map +1 -0
- package/build/dex/integral/types.d.ts +84 -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/lido.d.ts +19 -0
- package/build/dex/lido.js +42 -0
- package/build/dex/lido.js.map +1 -0
- package/build/dex/onebit.d.ts +25 -0
- package/build/dex/onebit.js +42 -0
- package/build/dex/onebit.js.map +1 -0
- package/build/dex/oswap/oswap.js +4 -1
- package/build/dex/oswap/oswap.js.map +1 -1
- package/build/dex/platypus/platypus.d.ts +1 -2
- package/build/dex/platypus/platypus.js +0 -31
- package/build/dex/platypus/platypus.js.map +1 -1
- package/build/dex/sdai/config.d.ts +11 -0
- package/build/dex/sdai/config.js +21 -0
- package/build/dex/sdai/config.js.map +1 -0
- package/build/dex/sdai/constants.d.ts +2 -0
- package/build/dex/sdai/constants.js +6 -0
- package/build/dex/sdai/constants.js.map +1 -0
- package/build/dex/sdai/scripts/validate-state.d.ts +1 -0
- package/build/dex/sdai/scripts/validate-state.js +102 -0
- package/build/dex/sdai/scripts/validate-state.js.map +1 -0
- package/build/dex/sdai/sdai-pool.d.ts +16 -0
- package/build/dex/sdai/sdai-pool.js +85 -0
- package/build/dex/sdai/sdai-pool.js.map +1 -0
- package/build/dex/sdai/sdai.d.ts +51 -0
- package/build/dex/sdai/sdai.js +172 -0
- package/build/dex/sdai/sdai.js.map +1 -0
- package/build/dex/sdai/types.d.ts +21 -0
- package/build/dex/sdai/types.js +11 -0
- package/build/dex/sdai/types.js.map +1 -0
- package/build/dex/sdai/utils.d.ts +4 -0
- package/build/dex/sdai/utils.js +39 -0
- package/build/dex/sdai/utils.js.map +1 -0
- package/build/dex/smoothy.d.ts +26 -0
- package/build/dex/smoothy.js +48 -0
- package/build/dex/smoothy.js.map +1 -0
- package/build/dex/stable-pool.d.ts +28 -0
- package/build/dex/stable-pool.js +62 -0
- package/build/dex/stable-pool.js.map +1 -0
- package/build/dex/swaap-v1/swaap-v1.d.ts +1 -2
- package/build/dex/swaap-v1/swaap-v1.js +0 -10
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/dex/trader-joe-v2.1.d.ts +43 -0
- package/build/dex/trader-joe-v2.1.js +79 -0
- package/build/dex/trader-joe-v2.1.js.map +1 -0
- package/build/executor/Executor01BytecodeBuilder.js +4 -5
- package/build/executor/Executor01BytecodeBuilder.js.map +1 -1
- package/build/executor/Executor02BytecodeBuilder.js +2 -3
- package/build/executor/Executor02BytecodeBuilder.js.map +1 -1
- package/build/executor/Executor03BytecodeBuilder.js +24 -14
- package/build/executor/Executor03BytecodeBuilder.js.map +1 -1
- package/build/executor/compressor/Compressor.d.ts +23 -0
- package/build/executor/compressor/Compressor.js +144 -0
- package/build/executor/compressor/Compressor.js.map +1 -0
- package/build/executor/compressor/compress.d.ts +17 -0
- package/build/executor/compressor/compress.js +187 -0
- package/build/executor/compressor/compress.js.map +1 -0
- package/build/executor/compressor/compress_functions/addressSubstitution.d.ts +6 -0
- package/build/executor/compressor/compress_functions/addressSubstitution.js +29 -0
- package/build/executor/compressor/compress_functions/addressSubstitution.js.map +1 -0
- package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.d.ts +10 -0
- package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js +40 -0
- package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js.map +1 -0
- package/build/executor/compressor/compress_functions/byteSubstitution.d.ts +11 -0
- package/build/executor/compressor/compress_functions/byteSubstitution.js +64 -0
- package/build/executor/compressor/compress_functions/byteSubstitution.js.map +1 -0
- package/build/executor/compressor/compress_functions/ffSubstitution.d.ts +7 -0
- package/build/executor/compressor/compress_functions/ffSubstitution.js +54 -0
- package/build/executor/compressor/compress_functions/ffSubstitution.js.map +1 -0
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute.d.ts +8 -0
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js +67 -0
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js.map +1 -0
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.d.ts +8 -0
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js +61 -0
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js.map +1 -0
- package/build/executor/compressor/compress_functions/reverseAddressSubstitution.d.ts +6 -0
- package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js +37 -0
- package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js.map +1 -0
- package/build/executor/compressor/compress_functions/searchUnusedBytes.d.ts +9 -0
- package/build/executor/compressor/compress_functions/searchUnusedBytes.js +33 -0
- package/build/executor/compressor/compress_functions/searchUnusedBytes.js.map +1 -0
- package/build/executor/compressor/fetchSaved.d.ts +0 -0
- package/build/executor/compressor/fetchSaved.js +17 -0
- package/build/executor/compressor/fetchSaved.js.map +1 -0
- package/build/executor/compressor/utils/computeCostL2.d.ts +2 -0
- package/build/executor/compressor/utils/computeCostL2.js +14 -0
- package/build/executor/compressor/utils/computeCostL2.js.map +1 -0
- package/build/executor/compressor/utils/findLongestDuplicatedString.d.ts +2 -0
- package/build/executor/compressor/utils/findLongestDuplicatedString.js +30 -0
- package/build/executor/compressor/utils/findLongestDuplicatedString.js.map +1 -0
- package/build/executor/compressor/utils/getAllIndexes.d.ts +2 -0
- package/build/executor/compressor/utils/getAllIndexes.js +12 -0
- package/build/executor/compressor/utils/getAllIndexes.js.map +1 -0
- package/build/executor/compressor/utils/getByteForAddress.d.ts +2 -0
- package/build/executor/compressor/utils/getByteForAddress.js +14 -0
- package/build/executor/compressor/utils/getByteForAddress.js.map +1 -0
- package/build/executor/compressor/utils/intTo2Bytes.d.ts +2 -0
- package/build/executor/compressor/utils/intTo2Bytes.js +14 -0
- package/build/executor/compressor/utils/intTo2Bytes.js.map +1 -0
- package/build/executor/compressor/utils/intTo3Bytes.d.ts +2 -0
- package/build/executor/compressor/utils/intTo3Bytes.js +18 -0
- package/build/executor/compressor/utils/intTo3Bytes.js.map +1 -0
- package/build/executor/compressor/utils/intToByte.d.ts +2 -0
- package/build/executor/compressor/utils/intToByte.js +10 -0
- package/build/executor/compressor/utils/intToByte.js.map +1 -0
- package/build/generic-swap-transaction-builder.d.ts +1 -1
- package/build/generic-swap-transaction-builder.js +10 -10
- package/build/generic-swap-transaction-builder.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/concentrator/arUSD.json +568 -0
- package/src/abi/concentrator/arUSD5115.json +1746 -0
- package/src/abi/fx-protocol/FxMarket.json +1284 -0
- package/src/abi/fx-protocol/FxUSD.json +1227 -0
- package/src/abi/fx-protocol/weETHOralce.json +676 -0
- package/src/dex/concentrator-arusd/concentrator-arusd-e2e.test.ts +92 -0
- package/src/dex/concentrator-arusd/concentrator-arusd-event.ts +100 -0
- package/src/dex/concentrator-arusd/concentrator-arusd-integration.test.ts +104 -0
- package/src/dex/concentrator-arusd/concentrator-arusd.ts +269 -0
- package/src/dex/concentrator-arusd/concetrator-arusd-events.test.ts +97 -0
- package/src/dex/concentrator-arusd/config.ts +13 -0
- package/src/dex/concentrator-arusd/types.ts +16 -0
- package/src/dex/concentrator-arusd/utils.ts +36 -0
- package/src/dex/fx-protocol-rusd/config.ts +14 -0
- package/src/dex/fx-protocol-rusd/fx-protocol-e2e.test.ts +96 -0
- package/src/dex/fx-protocol-rusd/fx-protocol-events.test.ts +101 -0
- package/src/dex/fx-protocol-rusd/fx-protocol-integration.test.ts +104 -0
- package/src/dex/fx-protocol-rusd/fx-protocol-rusd-event.ts +112 -0
- package/src/dex/fx-protocol-rusd/fx-protocol-rusd.ts +282 -0
- package/src/dex/fx-protocol-rusd/types.ts +16 -0
- package/src/dex/fx-protocol-rusd/utils.ts +47 -0
- package/src/dex/index.ts +4 -0
- package/src/dex/wsteth/wsteth-integration.test.ts +0 -1
- package/src/executor/Executor01BytecodeBuilder.ts +4 -8
- package/src/executor/Executor02BytecodeBuilder.ts +2 -7
- package/src/executor/Executor03BytecodeBuilder.ts +34 -19
- package/src/generic-swap-transaction-builder.ts +3 -5
- package/tests/constants-e2e.ts +10 -0
- package/build/abi/inception/inception-ineth.json +0 -609
- package/build/abi/inception/inception-ratio-feed.json +0 -93
- package/build/abi/inception/inception-vault.json +0 -991
- package/build/abi/infusion/InfusionFactory.json +0 -147
- package/build/abi/infusion/InfusionPair.json +0 -658
- package/build/abi/infusion/InfusionRouter.json +0 -442
- package/build/dex/idle-dao/idle-dao-pool.d.ts +0 -56
- package/build/dex/idle-dao/idle-dao-pool.js +0 -176
- package/build/dex/idle-dao/idle-dao-pool.js.map +0 -1
- package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +0 -16
- package/build/dex/idle-dao/idle-dao-pooling-pool.js +0 -57
- package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +0 -1
- package/build/dex/idle-dao/scripts.d.ts +0 -9
- package/build/dex/idle-dao/scripts.js +0 -552
- package/build/dex/idle-dao/scripts.js.map +0 -1
- package/build/dex/inception/config.d.ts +0 -5
- package/build/dex/inception/config.js +0 -112
- package/build/dex/inception/config.js.map +0 -1
- package/build/dex/inception/inception-event-pool.d.ts +0 -23
- package/build/dex/inception/inception-event-pool.js +0 -34
- package/build/dex/inception/inception-event-pool.js.map +0 -1
- package/build/dex/inception/inception-native.js +0 -131
- package/build/dex/inception/inception-native.js.map +0 -1
- package/build/dex/inception/inception-pool.d.ts +0 -18
- package/build/dex/inception/inception-pool.js +0 -32
- package/build/dex/inception/inception-pool.js.map +0 -1
- package/build/dex/inception/inception-price-feed.d.ts +0 -19
- package/build/dex/inception/inception-price-feed.js +0 -51
- package/build/dex/inception/inception-price-feed.js.map +0 -1
- package/build/dex/inception/inception.d.ts +0 -44
- package/build/dex/inception/inception.js +0 -162
- 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/infusion/config.js +0 -25
- package/build/dex/infusion/config.js.map +0 -1
- package/build/dex/infusion/infusion-stable-pool.d.ts +0 -4
- package/build/dex/infusion/infusion-stable-pool.js +0 -74
- package/build/dex/infusion/infusion-stable-pool.js.map +0 -1
- package/build/dex/infusion/infusion.d.ts +0 -54
- package/build/dex/infusion/infusion.js +0 -532
- package/build/dex/infusion/infusion.js.map +0 -1
- package/build/dex/infusion/types.d.ts +0 -47
- package/build/dex/infusion/types.js +0 -3
- package/build/dex/infusion/types.js.map +0 -1
- package/build/dex/infusion/utils/isStablePair.d.ts +0 -2
- package/build/dex/infusion/utils/isStablePair.js +0 -18
- package/build/dex/infusion/utils/isStablePair.js.map +0 -1
|
@@ -1,43 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { AdapterExchangeParam, Address, DexExchangeParam, ExchangePrices, Logger, PoolLiquidity, PoolPrices, Token } from '../../types';
|
|
5
|
-
import { Network } from '../../constants';
|
|
6
|
-
import { IDex } from '../../dex/idex';
|
|
1
|
+
import { Token, Address, ExchangePrices, AdapterExchangeParam, PoolLiquidity, Logger, PoolPrices, NumberAsString, DexExchangeParam } from '../../types';
|
|
2
|
+
import { SwapSide, Network } from '../../constants';
|
|
3
|
+
import { Context, IDex } from '../idex';
|
|
7
4
|
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
8
|
-
import {
|
|
5
|
+
import { IntegralData, QuotingProps } from './types';
|
|
9
6
|
import { SimpleExchange } from '../simple-exchange';
|
|
10
|
-
|
|
11
|
-
export declare const depositETHFunction = "stake()";
|
|
12
|
-
export declare class InceptionNative extends SimpleExchange implements IDex<InceptionData> {
|
|
7
|
+
export declare class Integral extends SimpleExchange implements IDex<IntegralData> {
|
|
13
8
|
readonly network: Network;
|
|
14
9
|
readonly dexKey: string;
|
|
15
10
|
readonly dexHelper: IDexHelper;
|
|
16
|
-
protected config: import("./types").DexParams;
|
|
17
11
|
protected adapters: import("../../types").AdapterMappings;
|
|
18
|
-
protected
|
|
19
|
-
protected vaultInterface: Interface;
|
|
20
|
-
protected tokenInterface: Interface;
|
|
12
|
+
protected subgraphURL: string | undefined;
|
|
21
13
|
readonly hasConstantPriceLargeAmounts = false;
|
|
22
|
-
readonly
|
|
14
|
+
private readonly context;
|
|
23
15
|
readonly isFeeOnTransferSupported = false;
|
|
24
16
|
static dexKeysWithNetwork: {
|
|
25
17
|
key: string;
|
|
26
18
|
networks: Network[];
|
|
27
19
|
}[];
|
|
28
20
|
logger: Logger;
|
|
29
|
-
constructor(network: Network, dexKey: string, dexHelper: IDexHelper,
|
|
21
|
+
constructor(network: Network, dexKey: string, dexHelper: IDexHelper, adapters?: import("../../types").AdapterMappings);
|
|
30
22
|
initializePricing(blockNumber: number): Promise<void>;
|
|
31
23
|
getAdapters(side: SwapSide): {
|
|
32
24
|
name: string;
|
|
33
25
|
index: number;
|
|
34
26
|
}[] | null;
|
|
35
27
|
getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
|
|
36
|
-
getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<
|
|
37
|
-
getCalldataGasCost(poolPrices: PoolPrices<
|
|
38
|
-
getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data:
|
|
39
|
-
getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data:
|
|
28
|
+
getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<IntegralData>>;
|
|
29
|
+
getCalldataGasCost(poolPrices: PoolPrices<IntegralData>): number | number[];
|
|
30
|
+
getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: IntegralData, side: SwapSide): AdapterExchangeParam;
|
|
31
|
+
getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: IntegralData, side: SwapSide, _: Context, executorAddress: Address): DexExchangeParam;
|
|
40
32
|
updatePoolState(): Promise<void>;
|
|
41
33
|
getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
|
|
42
|
-
|
|
34
|
+
getPriceOnChain(tokenIn: Token, tokenOut: Token, inverted: boolean, blockNumber: number): Promise<QuotingProps | null>;
|
|
35
|
+
private getQuotingProps;
|
|
36
|
+
private quoteSell;
|
|
37
|
+
private quoteBuy;
|
|
38
|
+
private checkLimits;
|
|
39
|
+
private getStates;
|
|
40
|
+
private getMaxLimits;
|
|
43
41
|
}
|
|
@@ -0,0 +1,377 @@
|
|
|
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.Integral = void 0;
|
|
30
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
31
|
+
const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
|
|
32
|
+
const constants_1 = require("../../constants");
|
|
33
|
+
const utils_1 = require("../../utils");
|
|
34
|
+
const types_1 = require("./types");
|
|
35
|
+
const simple_exchange_1 = require("../simple-exchange");
|
|
36
|
+
const config_1 = require("./config");
|
|
37
|
+
const relayer_json_1 = __importDefault(require("../../abi/integral/relayer.json"));
|
|
38
|
+
const abi_1 = require("@ethersproject/abi");
|
|
39
|
+
const bigint_constants_1 = require("../../bigint-constants");
|
|
40
|
+
const utils_2 = require("./utils");
|
|
41
|
+
const context_1 = require("./context");
|
|
42
|
+
const utils_3 = require("./utils");
|
|
43
|
+
const PRECISION = bigint_constants_1.BI_POWS[18];
|
|
44
|
+
const SUBGRAPH_TIMEOUT = 20 * 1000;
|
|
45
|
+
const SWAP_ORDER_TIMEOUT = Math.floor(Date.now() / 1000) + 24 * 3600;
|
|
46
|
+
const relayerInterface = new abi_1.Interface(relayer_json_1.default);
|
|
47
|
+
class Integral extends simple_exchange_1.SimpleExchange {
|
|
48
|
+
constructor(network, dexKey, dexHelper, adapters = config_1.Adapters[network] || {}) {
|
|
49
|
+
super(dexHelper, dexKey);
|
|
50
|
+
this.network = network;
|
|
51
|
+
this.dexKey = dexKey;
|
|
52
|
+
this.dexHelper = dexHelper;
|
|
53
|
+
this.adapters = adapters;
|
|
54
|
+
this.hasConstantPriceLargeAmounts = false;
|
|
55
|
+
this.isFeeOnTransferSupported = false;
|
|
56
|
+
this.logger = dexHelper.getLogger(dexKey);
|
|
57
|
+
this.context = context_1.IntegralContext.initialize(network, dexKey, dexHelper, this.erc20Interface, config_1.IntegralConfig[dexKey][network].factoryAddress.toLowerCase(), config_1.IntegralConfig[dexKey][network].relayerAddress.toLowerCase());
|
|
58
|
+
this.subgraphURL = config_1.IntegralConfig[dexKey][network].subgraphURL;
|
|
59
|
+
}
|
|
60
|
+
async initializePricing(blockNumber) {
|
|
61
|
+
await this.context.factory.initialize(blockNumber);
|
|
62
|
+
const factoryState = this.context.factory.getState(blockNumber);
|
|
63
|
+
if (factoryState) {
|
|
64
|
+
await this.context.addPools(factoryState.pools, blockNumber, true);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// Returns the list of contract adapters (name and index)
|
|
68
|
+
// for a buy/sell. Return null if there are no adapters.
|
|
69
|
+
getAdapters(side) {
|
|
70
|
+
return this.adapters[side] ? this.adapters[side] : null;
|
|
71
|
+
}
|
|
72
|
+
async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
|
|
73
|
+
const src = this.dexHelper.config.wrapETH(srcToken);
|
|
74
|
+
const dest = this.dexHelper.config.wrapETH(destToken);
|
|
75
|
+
if (src.address.toLowerCase() === dest.address.toLowerCase()) {
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
const tokenAddresses = [
|
|
79
|
+
src.address.toLowerCase(),
|
|
80
|
+
dest.address.toLowerCase(),
|
|
81
|
+
]
|
|
82
|
+
.sort((a, b) => (a > b ? 1 : -1))
|
|
83
|
+
.join('_');
|
|
84
|
+
const poolIdentifier = `${this.dexKey}_${tokenAddresses}`;
|
|
85
|
+
return [poolIdentifier];
|
|
86
|
+
}
|
|
87
|
+
// Returns pool prices for amounts.
|
|
88
|
+
// If limitPools is defined only pools in limitPools
|
|
89
|
+
// should be used. If limitPools is undefined then
|
|
90
|
+
// any pools can be used.
|
|
91
|
+
async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
|
|
92
|
+
const src = this.dexHelper.config.wrapETH(srcToken);
|
|
93
|
+
const dest = this.dexHelper.config.wrapETH(destToken);
|
|
94
|
+
if (src.address.toLowerCase() === dest.address.toLowerCase()) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
const poolIdentifier = (0, utils_2.getPoolIdentifier)(this.dexKey, src.address, dest.address);
|
|
98
|
+
if (limitPools && limitPools.every(p => p !== poolIdentifier)) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
const props = await this.getQuotingProps(src, dest, blockNumber);
|
|
102
|
+
if (!props) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
const unitAmount = (0, utils_1.getBigIntPow)(side == constants_1.SwapSide.SELL ? src.decimals : dest.decimals);
|
|
106
|
+
const unit = side == constants_1.SwapSide.SELL
|
|
107
|
+
? this.quoteSell(unitAmount, props, false)
|
|
108
|
+
: this.quoteBuy(unitAmount, props, false);
|
|
109
|
+
try {
|
|
110
|
+
const prices = side == constants_1.SwapSide.SELL
|
|
111
|
+
? amounts.map(amount => this.quoteSell(amount, props))
|
|
112
|
+
: amounts.map(amount => this.quoteBuy(amount, props));
|
|
113
|
+
return [
|
|
114
|
+
{
|
|
115
|
+
prices: prices,
|
|
116
|
+
unit: unit,
|
|
117
|
+
data: {
|
|
118
|
+
relayer: this.context.relayerAddress,
|
|
119
|
+
},
|
|
120
|
+
exchange: this.dexKey,
|
|
121
|
+
poolIdentifier,
|
|
122
|
+
gasCost: 0,
|
|
123
|
+
poolAddresses: this.context.getPoolAddresses(),
|
|
124
|
+
},
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
catch (e) {
|
|
128
|
+
this.logger.error(`Error_getPricesVolume could not get price with error:`, e);
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// Returns estimated gas cost of calldata for this DEX in multiSwap
|
|
133
|
+
getCalldataGasCost(poolPrices) {
|
|
134
|
+
return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
|
|
135
|
+
}
|
|
136
|
+
// Encode params required by the exchange adapter
|
|
137
|
+
// Used for multiSwap, buy & megaSwap
|
|
138
|
+
// Hint: abiCoder.encodeParameter() could be useful
|
|
139
|
+
getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
140
|
+
const { relayer: exchange } = data;
|
|
141
|
+
// Encode here the payload for adapter
|
|
142
|
+
const payload = '0x';
|
|
143
|
+
return {
|
|
144
|
+
targetExchange: exchange,
|
|
145
|
+
payload,
|
|
146
|
+
networkFee: '0',
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side, _, executorAddress) {
|
|
150
|
+
const { relayer: exchange } = data;
|
|
151
|
+
const tokenIn = this.dexHelper.config.wrapETH(srcToken);
|
|
152
|
+
const tokenOut = this.dexHelper.config.wrapETH(destToken);
|
|
153
|
+
const swapData = relayerInterface.encodeFunctionData(side === constants_1.SwapSide.SELL ? types_1.IntegralFunctions.swap : types_1.IntegralFunctions.buy, [
|
|
154
|
+
{
|
|
155
|
+
...{
|
|
156
|
+
tokenIn,
|
|
157
|
+
tokenOut,
|
|
158
|
+
wrapUnwrap: (0, utils_1.isETHAddress)(srcToken) || (0, utils_1.isETHAddress)(destToken),
|
|
159
|
+
to: recipient,
|
|
160
|
+
submitDeadline: SWAP_ORDER_TIMEOUT,
|
|
161
|
+
},
|
|
162
|
+
...(side === constants_1.SwapSide.SELL
|
|
163
|
+
? { amountIn: srcAmount, amountOutMin: destAmount }
|
|
164
|
+
: { amountInMax: srcAmount, amountOut: destAmount }),
|
|
165
|
+
},
|
|
166
|
+
]);
|
|
167
|
+
return {
|
|
168
|
+
needWrapNative: this.needWrapNative,
|
|
169
|
+
dexFuncHasRecipient: true,
|
|
170
|
+
exchangeData: swapData,
|
|
171
|
+
targetExchange: exchange,
|
|
172
|
+
returnAmountPos: undefined,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
async updatePoolState() { }
|
|
176
|
+
// Returns list of top pools based on liquidity. Max
|
|
177
|
+
// limit number pools should be returned.
|
|
178
|
+
async getTopPoolsForToken(tokenAddress, limit) {
|
|
179
|
+
if (!this.subgraphURL) {
|
|
180
|
+
return [];
|
|
181
|
+
}
|
|
182
|
+
const query = `
|
|
183
|
+
query ($token: Bytes!, $limit: Int) {
|
|
184
|
+
pools0: pairs(
|
|
185
|
+
first: $limit
|
|
186
|
+
orderBy: reserveUSD
|
|
187
|
+
orderDirection: desc
|
|
188
|
+
where: {token0: $token}
|
|
189
|
+
) {
|
|
190
|
+
id
|
|
191
|
+
token0 {
|
|
192
|
+
id
|
|
193
|
+
decimals
|
|
194
|
+
}
|
|
195
|
+
token1 {
|
|
196
|
+
id
|
|
197
|
+
decimals
|
|
198
|
+
}
|
|
199
|
+
reserveUSD
|
|
200
|
+
}
|
|
201
|
+
pools1: pairs(
|
|
202
|
+
first: $limit
|
|
203
|
+
orderBy: reserveUSD
|
|
204
|
+
orderDirection: desc
|
|
205
|
+
where: {token1: $token}
|
|
206
|
+
) {
|
|
207
|
+
id
|
|
208
|
+
token0 {
|
|
209
|
+
id
|
|
210
|
+
decimals
|
|
211
|
+
}
|
|
212
|
+
token1 {
|
|
213
|
+
id
|
|
214
|
+
decimals
|
|
215
|
+
}
|
|
216
|
+
reserveUSD
|
|
217
|
+
}
|
|
218
|
+
}`;
|
|
219
|
+
const { data } = await this.dexHelper.httpRequest.querySubgraph(this.subgraphURL, {
|
|
220
|
+
query,
|
|
221
|
+
variables: { token: tokenAddress.toLowerCase(), limit },
|
|
222
|
+
}, { timeout: SUBGRAPH_TIMEOUT });
|
|
223
|
+
if (!(data && data.pools0 && data.pools1))
|
|
224
|
+
throw new Error("Couldn't fetch the pools from the subgraph");
|
|
225
|
+
const pools0 = lodash_1.default.map(data.pools0, pool => ({
|
|
226
|
+
exchange: this.dexKey,
|
|
227
|
+
address: pool.id.toLowerCase(),
|
|
228
|
+
connectorTokens: [
|
|
229
|
+
{
|
|
230
|
+
address: pool.token1.id.toLowerCase(),
|
|
231
|
+
decimals: parseInt(pool.token1.decimals),
|
|
232
|
+
},
|
|
233
|
+
],
|
|
234
|
+
liquidityUSD: parseFloat(pool.reserveUSD),
|
|
235
|
+
}));
|
|
236
|
+
const pools1 = lodash_1.default.map(data.pools1, pool => ({
|
|
237
|
+
exchange: this.dexKey,
|
|
238
|
+
address: pool.id.toLowerCase(),
|
|
239
|
+
connectorTokens: [
|
|
240
|
+
{
|
|
241
|
+
address: pool.token0.id.toLowerCase(),
|
|
242
|
+
decimals: parseInt(pool.token0.decimals),
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
liquidityUSD: parseFloat(pool.reserveUSD),
|
|
246
|
+
}));
|
|
247
|
+
return lodash_1.default.slice(lodash_1.default.sortBy(lodash_1.default.concat(pools0, pools1), [pool => -1 * pool.liquidityUSD]), 0, limit);
|
|
248
|
+
}
|
|
249
|
+
async getPriceOnChain(tokenIn, tokenOut, inverted, blockNumber) {
|
|
250
|
+
try {
|
|
251
|
+
const calldata = [
|
|
252
|
+
{
|
|
253
|
+
target: this.context.relayerAddress,
|
|
254
|
+
callData: relayerInterface.encodeFunctionData('getPoolState', [
|
|
255
|
+
tokenIn.address,
|
|
256
|
+
tokenOut.address,
|
|
257
|
+
]),
|
|
258
|
+
},
|
|
259
|
+
];
|
|
260
|
+
const data = await this.dexHelper.multiContract.methods
|
|
261
|
+
.aggregate(calldata)
|
|
262
|
+
.call({}, blockNumber);
|
|
263
|
+
const result = relayerInterface.decodeFunctionResult('getPoolState', data.returnData[0]);
|
|
264
|
+
const _limits = inverted
|
|
265
|
+
? [result.limitMin1, result.limitMax1]
|
|
266
|
+
: [result.limitMin0, result.limitMax0];
|
|
267
|
+
const limits = [
|
|
268
|
+
BigInt(_limits[0].toString()),
|
|
269
|
+
BigInt(_limits[1].toString()),
|
|
270
|
+
];
|
|
271
|
+
const [decimals0, decimals1] = inverted
|
|
272
|
+
? [tokenOut.decimals, tokenIn.decimals]
|
|
273
|
+
: [tokenIn.decimals, tokenOut.decimals];
|
|
274
|
+
return {
|
|
275
|
+
price: BigInt(result.price.toString()),
|
|
276
|
+
fee: BigInt(result.fee.toString()),
|
|
277
|
+
tokenOutLimits: limits,
|
|
278
|
+
decimalsConverter: (0, utils_2.getDecimalsConverter)(decimals0, decimals1, inverted),
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
catch (e) {
|
|
282
|
+
this.logger.error(`Error_getPriceOnChain could not get data with error:`, e);
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
async getQuotingProps(src, dest, blockNumber) {
|
|
287
|
+
const poolId = (0, utils_2.getPoolIdentifier)(this.dexKey, src.address, dest.address);
|
|
288
|
+
const inverted = (0, utils_2.isInverted)(src.address, dest.address);
|
|
289
|
+
const states = this.getStates(poolId, blockNumber);
|
|
290
|
+
if (!states) {
|
|
291
|
+
return await this.getPriceOnChain(src, dest, inverted, blockNumber);
|
|
292
|
+
}
|
|
293
|
+
const { base, poolAddress, relayer, relayerTokens } = states;
|
|
294
|
+
const price = (0, utils_2.getPrice)(states, inverted);
|
|
295
|
+
const token0 = (0, utils_2.sortTokens)(src.address, dest.address)[0];
|
|
296
|
+
const { max0, max1 } = this.getMaxLimits(poolAddress, relayer, relayerTokens);
|
|
297
|
+
const props = {
|
|
298
|
+
price,
|
|
299
|
+
fee: relayer.swapFee,
|
|
300
|
+
tokenOutLimits: dest.address === token0
|
|
301
|
+
? [relayer.limits.min0, max0]
|
|
302
|
+
: [relayer.limits.min1, max1],
|
|
303
|
+
decimalsConverter: (0, utils_2.getDecimalsConverter)(base.decimals0, base.decimals1, inverted),
|
|
304
|
+
};
|
|
305
|
+
return props;
|
|
306
|
+
}
|
|
307
|
+
quoteSell(amountIn, props, checkLimit = true) {
|
|
308
|
+
if (amountIn === 0n) {
|
|
309
|
+
return 0n;
|
|
310
|
+
}
|
|
311
|
+
const fee = (amountIn * props.fee) / PRECISION;
|
|
312
|
+
const amountInMinusFee = amountIn - fee;
|
|
313
|
+
const amountOut = (amountInMinusFee * props.price) / props.decimalsConverter;
|
|
314
|
+
if (checkLimit && !this.checkLimits(amountOut, props.tokenOutLimits)) {
|
|
315
|
+
return 0n;
|
|
316
|
+
// throw new Error(
|
|
317
|
+
// `Out of Limits - amountOut ${amountOut} not in between limits ${props.tokenOutLimits}`,
|
|
318
|
+
// );
|
|
319
|
+
}
|
|
320
|
+
return amountOut;
|
|
321
|
+
}
|
|
322
|
+
quoteBuy(amountOut, props, checkLimit = true) {
|
|
323
|
+
if (amountOut === 0n) {
|
|
324
|
+
return 0n;
|
|
325
|
+
}
|
|
326
|
+
if (checkLimit && !this.checkLimits(amountOut, props.tokenOutLimits)) {
|
|
327
|
+
return 0n;
|
|
328
|
+
// throw new Error(
|
|
329
|
+
// `Out of Limits - amountOut ${amountOut} not in between limits ${props.tokenOutLimits}`,
|
|
330
|
+
// );
|
|
331
|
+
}
|
|
332
|
+
const amountIn = (0, utils_3.ceil_div)(amountOut * props.decimalsConverter, props.price);
|
|
333
|
+
if (amountIn <= 0n) {
|
|
334
|
+
return 0n;
|
|
335
|
+
}
|
|
336
|
+
const amountInPlusFee = (0, utils_3.ceil_div)(amountIn * PRECISION, PRECISION - props.fee);
|
|
337
|
+
return amountInPlusFee;
|
|
338
|
+
}
|
|
339
|
+
checkLimits(amount, limits) {
|
|
340
|
+
if (amount < limits[0] || amount > limits[1]) {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
return true;
|
|
344
|
+
}
|
|
345
|
+
getStates(poolId, blockNumber) {
|
|
346
|
+
const poolStates = this.context.pools[poolId];
|
|
347
|
+
if (poolStates && poolStates.base) {
|
|
348
|
+
const base = poolStates.base.getState(blockNumber);
|
|
349
|
+
const pricing = poolStates.pricing && poolStates.pricing.getState(blockNumber);
|
|
350
|
+
const relayerState = this.context.relayer.getState(blockNumber);
|
|
351
|
+
const relayer = relayerState && relayerState.pools[poolStates.base.poolAddress];
|
|
352
|
+
return base && pricing && relayer
|
|
353
|
+
? {
|
|
354
|
+
base,
|
|
355
|
+
pricing,
|
|
356
|
+
relayer,
|
|
357
|
+
relayerTokens: relayerState.tokens,
|
|
358
|
+
poolAddress: poolStates.base.poolAddress,
|
|
359
|
+
}
|
|
360
|
+
: null;
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
return null;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
getMaxLimits(poolAddress, relayer, relayerTokens) {
|
|
367
|
+
const { token0, token1 } = this.context.relayer.getPools()[poolAddress.toLowerCase()];
|
|
368
|
+
const max0 = (relayerTokens[token0].balance * relayer.limits.maxMultiplier0) /
|
|
369
|
+
10n ** 18n;
|
|
370
|
+
const max1 = (relayerTokens[token1].balance * relayer.limits.maxMultiplier1) /
|
|
371
|
+
10n ** 18n;
|
|
372
|
+
return { max0, max1 };
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
exports.Integral = Integral;
|
|
376
|
+
Integral.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.IntegralConfig);
|
|
377
|
+
//# sourceMappingURL=integral.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integral.js","sourceRoot":"","sources":["../../../src/dex/integral/integral.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAuB;AAEvB,2EAA6D;AAY7D,+CAAoD;AACpD,uCAAgF;AAGhF,mCAOiB;AACjB,wDAAoD;AACpD,qCAAoD;AACpD,mFAAiE;AACjE,4CAA+C;AAC/C,6DAAiD;AACjD,mCAMiB;AACjB,uCAA4C;AAC5C,mCAAmC;AAEnC,MAAM,SAAS,GAAG,0BAAO,CAAC,EAAE,CAAC,CAAC;AAC9B,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAC;AACnC,MAAM,kBAAkB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACrE,MAAM,gBAAgB,GAAG,IAAI,eAAS,CAAC,sBAAkB,CAAC,CAAC;AAE3D,MAAa,QAAS,SAAQ,gCAAc;IAY1C,YACW,OAAgB,EAChB,MAAc,EACd,SAAqB,EACpB,WAAW,iBAAQ,CAAC,OAAO,CAAC,IAAI,EAAE;QAE5C,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QALhB,YAAO,GAAP,OAAO,CAAS;QAChB,WAAM,GAAN,MAAM,CAAQ;QACd,cAAS,GAAT,SAAS,CAAY;QACpB,aAAQ,GAAR,QAAQ,CAA0B;QAdrC,iCAA4B,GAAG,KAAK,CAAC;QAGrC,6BAAwB,GAAG,KAAK,CAAC;QAcxC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAE1C,IAAI,CAAC,OAAO,G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IAAI,GACR,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC;YAC/D,GAAG,IAAI,GAAG,CAAC;QACb,MAAM,IAAI,GACR,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC;YAC/D,GAAG,IAAI,GAAG,CAAC;QACb,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACxB,CAAC;;AA3dH,4BA4dC;AArde,2BAAkB,GAC9B,IAAA,6BAAqB,EAAC,uBAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Address } from '../../types';
|
|
2
|
+
import { IntegralEventPool } from './integral-pool';
|
|
3
|
+
import { PoolState as UniswapPoolState } from '../uniswap-v3/types';
|
|
4
|
+
import { BigNumber } from 'ethers';
|
|
5
|
+
import { IntegralPricing } from './integral-pricing';
|
|
6
|
+
export declare type Requires<Class, Prop extends keyof Class> = Class & Required<Pick<Class, Prop>>;
|
|
7
|
+
export declare type IntegralPool = {
|
|
8
|
+
base?: IntegralEventPool;
|
|
9
|
+
pricing?: IntegralPricing;
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare type QuotingProps = {
|
|
13
|
+
price: bigint;
|
|
14
|
+
fee: bigint;
|
|
15
|
+
tokenOutLimits: [bigint, bigint];
|
|
16
|
+
decimalsConverter: bigint;
|
|
17
|
+
};
|
|
18
|
+
export declare type PoolState = {
|
|
19
|
+
swapFee: bigint;
|
|
20
|
+
mintFee: bigint;
|
|
21
|
+
burnFee: bigint;
|
|
22
|
+
decimals0: number;
|
|
23
|
+
decimals1: number;
|
|
24
|
+
oracle: Address;
|
|
25
|
+
uniswapPool: Address;
|
|
26
|
+
uniswapPoolFee: bigint;
|
|
27
|
+
};
|
|
28
|
+
export declare type RelayerPoolState = {
|
|
29
|
+
isEnabled: boolean;
|
|
30
|
+
swapFee: bigint;
|
|
31
|
+
twapInterval: number;
|
|
32
|
+
limits: {
|
|
33
|
+
min0: bigint;
|
|
34
|
+
min1: bigint;
|
|
35
|
+
maxMultiplier0: bigint;
|
|
36
|
+
maxMultiplier1: bigint;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare type RelayerTokensState = {
|
|
40
|
+
[tokenAddress: string]: {
|
|
41
|
+
balance: bigint;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export declare type RelayerState = {
|
|
45
|
+
pools: {
|
|
46
|
+
[poolAddress: string]: RelayerPoolState;
|
|
47
|
+
};
|
|
48
|
+
tokens: RelayerTokensState;
|
|
49
|
+
};
|
|
50
|
+
export declare type PoolInitProps = {
|
|
51
|
+
[poolAddress: string]: {
|
|
52
|
+
token0: Address;
|
|
53
|
+
token1: Address;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export declare type FactoryState = {
|
|
57
|
+
pools: PoolInitProps;
|
|
58
|
+
};
|
|
59
|
+
export declare type PoolStates = {
|
|
60
|
+
base: PoolState;
|
|
61
|
+
relayer: RelayerPoolState;
|
|
62
|
+
relayerTokens: RelayerTokensState;
|
|
63
|
+
pricing: UniswapPoolState;
|
|
64
|
+
poolAddress: Address;
|
|
65
|
+
};
|
|
66
|
+
export declare type TokenState = Record<string, never>;
|
|
67
|
+
export declare type IntegralData = {
|
|
68
|
+
relayer: Address;
|
|
69
|
+
};
|
|
70
|
+
export declare type DexParams = {
|
|
71
|
+
factoryAddress: string;
|
|
72
|
+
relayerAddress: string;
|
|
73
|
+
subgraphURL?: string;
|
|
74
|
+
};
|
|
75
|
+
export declare enum IntegralFunctions {
|
|
76
|
+
swap = "sell",
|
|
77
|
+
buy = "buy"
|
|
78
|
+
}
|
|
79
|
+
export declare type Observation = {
|
|
80
|
+
blockTimestamp: number;
|
|
81
|
+
initialized: boolean;
|
|
82
|
+
secondsPerLiquidityCumulativeX128: BigNumber;
|
|
83
|
+
tickCumulative: BigNumber;
|
|
84
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IntegralFunctions = void 0;
|
|
4
|
+
var IntegralFunctions;
|
|
5
|
+
(function (IntegralFunctions) {
|
|
6
|
+
IntegralFunctions["swap"] = "sell";
|
|
7
|
+
IntegralFunctions["buy"] = "buy";
|
|
8
|
+
})(IntegralFunctions = exports.IntegralFunctions || (exports.IntegralFunctions = {}));
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/integral/types.ts"],"names":[],"mappings":";;;AA6EA,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,kCAAa,CAAA;IACb,gCAAW,CAAA;AACb,CAAC,EAHW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAG5B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Address } from '../../types';
|
|
2
|
+
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
3
|
+
import { Provider } from '@ethersproject/providers';
|
|
4
|
+
export declare function updateEventSubscriber<SubscriberState>(eventSubscriber: StatefulEventSubscriber<SubscriberState>, subscribedAddress: Address[], fetchState: (blocknumber: number) => Promise<SubscriberState>, blockNumber: number, cacheKey: string, provider: Provider): Promise<void>;
|
|
5
|
+
export declare function checkEventSubscriber<SubscriberState>(eventSubscriber: StatefulEventSubscriber<SubscriberState>, fetchState: (blocknumber: number) => Promise<SubscriberState>, blockNumber: number, cacheKey: string, stateCompare?: (state: SubscriberState, expectedState: SubscriberState) => void): Promise<void>;
|
|
6
|
+
export declare function deepTypecast<T>(obj: any, checker: (val: any) => boolean, caster: (val: T) => any): any;
|
|
7
|
+
export declare function getSavedConfig<Config>(blockNumber: number, cacheKey: string): Config | undefined;
|
|
8
|
+
export declare function saveConfig<Config>(blockNumber: number, cacheKey: string, config: Config): void;
|
|
9
|
+
export declare function getSavedState<SubscriberState>(blockNumber: number, cacheKey: string): SubscriberState | undefined;
|