@paraswap/dex-lib 2.37.5 → 2.37.6-dexalot
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/vcs.xml +6 -0
- package/build/abi/algebra/AlgebraPool.abi.json +727 -0
- package/build/abi/curve-v1/StableSwapFRXETH.json +889 -0
- package/build/abi/curve-v1/StableSwapWBETH.json +1223 -0
- package/build/abi/dexalot/DexalotMainnetRFQ.json +952 -0
- package/build/abi/sushiswap-v3/QuoterV2.json +267 -0
- package/build/abi/sushiswap-v3/RouterProcessor3.json +289 -0
- package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +193 -0
- package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3QuoterV2.abi.json +285 -0
- package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3Router.abi.json +583 -0
- package/build/abi/wBETH.json +1527 -0
- package/build/abi/woo-fi/WooFeeManager.abi.json +318 -0
- package/build/abi/woo-fi/WooPP.abi.json +548 -0
- package/build/abi/woo-fi/Wooracle.abi.json +260 -0
- package/build/config.js +4 -2
- package/build/config.js.map +1 -1
- package/build/dex/aave-v3/tokens/arbitrum.json +50 -0
- package/build/dex/aave-v3/tokens/avalanche.json +74 -0
- package/build/dex/aave-v3/tokens/fantom.json +62 -0
- package/build/dex/aave-v3/tokens/optimism.json +50 -0
- package/build/dex/aave-v3/tokens/polygon.json +116 -0
- package/build/dex/algebra/algebra-pool.d.ts +46 -0
- package/build/dex/algebra/algebra-pool.js +336 -0
- package/build/dex/algebra/algebra-pool.js.map +1 -0
- package/build/dex/balancer-v2/LinearMath.d.ts +19 -0
- package/build/dex/balancer-v2/LinearMath.js +179 -0
- package/build/dex/balancer-v2/LinearMath.js.map +1 -0
- package/build/dex/balancer-v2/LinearPool.d.ts +47 -0
- package/build/dex/balancer-v2/LinearPool.js +324 -0
- package/build/dex/balancer-v2/LinearPool.js.map +1 -0
- package/build/dex/balancer-v2/PhantomStablePool.d.ts +47 -0
- package/build/dex/balancer-v2/PhantomStablePool.js +294 -0
- package/build/dex/balancer-v2/PhantomStablePool.js.map +1 -0
- package/build/dex/balancer-v2/StableMath.d.ts +9 -0
- package/build/dex/balancer-v2/StableMath.js +272 -0
- package/build/dex/balancer-v2/StableMath.js.map +1 -0
- package/build/dex/balancer-v2/balancer-v2-pool.d.ts +75 -0
- package/build/dex/balancer-v2/balancer-v2-pool.js +417 -0
- package/build/dex/balancer-v2/balancer-v2-pool.js.map +1 -0
- package/build/dex/curve-v1/pools/frxETHpool.d.ts +7 -0
- package/build/dex/curve-v1/pools/frxETHpool.js +27 -0
- package/build/dex/curve-v1/pools/frxETHpool.js.map +1 -0
- package/build/dex/curve-v1/pools/wbETHpool.d.ts +29 -0
- package/build/dex/curve-v1/pools/wbETHpool.js +408 -0
- package/build/dex/curve-v1/pools/wbETHpool.js.map +1 -0
- package/build/dex/{my-test-dex → dexalot}/config.d.ts +1 -1
- package/build/dex/dexalot/config.js +18 -0
- package/build/dex/dexalot/config.js.map +1 -0
- package/build/dex/dexalot/constants.d.ts +15 -0
- package/build/dex/dexalot/constants.js +22 -0
- package/build/dex/dexalot/constants.js.map +1 -0
- package/build/dex/dexalot/dexalot.d.ts +69 -0
- package/build/dex/dexalot/dexalot.js +642 -0
- package/build/dex/dexalot/dexalot.js.map +1 -0
- package/build/dex/dexalot/rate-fetcher.d.ts +28 -0
- package/build/dex/dexalot/rate-fetcher.js +100 -0
- package/build/dex/dexalot/rate-fetcher.js.map +1 -0
- package/build/dex/dexalot/types.d.ts +114 -0
- package/build/dex/dexalot/types.js +12 -0
- package/build/dex/dexalot/types.js.map +1 -0
- package/build/dex/dexalot/validators.d.ts +5 -0
- package/build/dex/dexalot/validators.js +45 -0
- package/build/dex/dexalot/validators.js.map +1 -0
- package/build/dex/idex.d.ts +1 -1
- package/build/dex/index.js +2 -0
- package/build/dex/index.js.map +1 -1
- package/build/dex/pancakeswap-v3/types.d.ts +14 -0
- package/build/dex/{my-test-dex → pancakeswap-v3}/types.js.map +1 -1
- package/build/dex/quickswap/camelot-v3.d.ts +6 -0
- package/build/dex/quickswap/camelot-v3.js +19 -0
- package/build/dex/quickswap/camelot-v3.js.map +1 -0
- package/build/dex/quickswap/zyberswap-v3.d.ts +6 -0
- package/build/dex/quickswap/zyberswap-v3.js +19 -0
- package/build/dex/quickswap/zyberswap-v3.js.map +1 -0
- package/build/dex/quickswap-v3.d.ts +21 -0
- package/build/dex/quickswap-v3.js +40 -0
- package/build/dex/quickswap-v3.js.map +1 -0
- package/build/dex/ramses-v2/config.d.ts +4 -0
- package/build/dex/ramses-v2/config.js +28 -0
- package/build/dex/ramses-v2/config.js.map +1 -0
- package/build/dex/ramses-v2/constants.d.ts +28 -0
- package/build/dex/ramses-v2/constants.js +35 -0
- package/build/dex/ramses-v2/constants.js.map +1 -0
- package/build/dex/ramses-v2/contract-math/BitMath.d.ts +4 -0
- package/build/dex/ramses-v2/contract-math/BitMath.js +93 -0
- package/build/dex/ramses-v2/contract-math/BitMath.js.map +1 -0
- package/build/dex/ramses-v2/contract-math/FixedPoint128.d.ts +3 -0
- package/build/dex/ramses-v2/contract-math/FixedPoint128.js +8 -0
- package/build/dex/ramses-v2/contract-math/FixedPoint128.js.map +1 -0
- package/build/dex/ramses-v2/contract-math/FixedPoint96.d.ts +4 -0
- package/build/dex/ramses-v2/contract-math/FixedPoint96.js +9 -0
- package/build/dex/ramses-v2/contract-math/FixedPoint96.js.map +1 -0
- package/build/dex/ramses-v2/contract-math/FullMath.d.ts +4 -0
- package/build/dex/ramses-v2/contract-math/FullMath.js +19 -0
- package/build/dex/ramses-v2/contract-math/FullMath.js.map +1 -0
- package/build/dex/ramses-v2/contract-math/LiquidityMath.d.ts +3 -0
- package/build/dex/ramses-v2/contract-math/LiquidityMath.js +22 -0
- package/build/dex/ramses-v2/contract-math/LiquidityMath.js.map +1 -0
- package/build/dex/ramses-v2/contract-math/Oracle.d.ts +10 -0
- package/build/dex/ramses-v2/contract-math/Oracle.js +133 -0
- package/build/dex/ramses-v2/contract-math/Oracle.js.map +1 -0
- package/build/dex/ramses-v2/contract-math/SqrtPriceMath.d.ts +10 -0
- package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js +91 -0
- package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js.map +1 -0
- package/build/dex/ramses-v2/contract-math/SwapMath.d.ts +8 -0
- package/build/dex/ramses-v2/contract-math/SwapMath.js +70 -0
- package/build/dex/ramses-v2/contract-math/SwapMath.js.map +1 -0
- package/build/dex/ramses-v2/contract-math/Tick.d.ts +7 -0
- package/build/dex/ramses-v2/contract-math/Tick.js +45 -0
- package/build/dex/ramses-v2/contract-math/Tick.js.map +1 -0
- package/build/dex/ramses-v2/contract-math/TickBitMap.d.ts +8 -0
- package/build/dex/ramses-v2/contract-math/TickBitMap.js +87 -0
- package/build/dex/ramses-v2/contract-math/TickBitMap.js.map +1 -0
- package/build/dex/ramses-v2/contract-math/TickMath.d.ts +8 -0
- package/build/dex/ramses-v2/contract-math/TickMath.js +162 -0
- package/build/dex/ramses-v2/contract-math/TickMath.js.map +1 -0
- package/build/dex/ramses-v2/contract-math/UnsafeMath.d.ts +3 -0
- package/build/dex/ramses-v2/contract-math/UnsafeMath.js +10 -0
- package/build/dex/ramses-v2/contract-math/UnsafeMath.js.map +1 -0
- package/build/dex/ramses-v2/contract-math/uniswap-v3-math.d.ts +18 -0
- package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js +392 -0
- package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js.map +1 -0
- package/build/dex/ramses-v2/contract-math/utils.d.ts +3 -0
- package/build/dex/ramses-v2/contract-math/utils.js +16 -0
- package/build/dex/ramses-v2/contract-math/utils.js.map +1 -0
- package/build/dex/ramses-v2/ramses-v2-pool.d.ts +42 -0
- package/build/dex/ramses-v2/ramses-v2-pool.js +307 -0
- package/build/dex/ramses-v2/ramses-v2-pool.js.map +1 -0
- package/build/dex/ramses-v2/ramses-v2.d.ts +61 -0
- package/build/dex/ramses-v2/ramses-v2.js +690 -0
- package/build/dex/ramses-v2/ramses-v2.js.map +1 -0
- package/build/dex/ramses-v2/types.d.ts +154 -0
- package/build/dex/ramses-v2/types.js +9 -0
- package/build/dex/ramses-v2/types.js.map +1 -0
- package/build/dex/ramses-v2/utils.d.ts +6 -0
- package/build/dex/ramses-v2/utils.js +71 -0
- package/build/dex/ramses-v2/utils.js.map +1 -0
- package/build/dex/sushiswap-v3/config.d.ts +4 -0
- package/build/dex/sushiswap-v3/config.js +132 -0
- package/build/dex/sushiswap-v3/config.js.map +1 -0
- package/build/dex/sushiswap-v3/constants.d.ts +4 -0
- package/build/dex/sushiswap-v3/constants.js +32 -0
- package/build/dex/sushiswap-v3/constants.js.map +1 -0
- package/build/dex/sushiswap-v3/sushiswap-v3-original.d.ts +56 -0
- package/build/dex/sushiswap-v3/sushiswap-v3-original.js +598 -0
- package/build/dex/sushiswap-v3/sushiswap-v3-original.js.map +1 -0
- package/build/dex/sushiswap-v3/sushiswap-v3-pool.d.ts +1 -0
- package/build/dex/sushiswap-v3/sushiswap-v3-pool.js +6 -0
- package/build/dex/sushiswap-v3/sushiswap-v3-pool.js.map +1 -0
- package/build/dex/sushiswap-v3/sushiswap-v3.d.ts +21 -0
- package/build/dex/sushiswap-v3/sushiswap-v3.js +58 -0
- package/build/dex/sushiswap-v3/sushiswap-v3.js.map +1 -0
- package/build/dex/sushiswap-v3/token.d.ts +6 -0
- package/build/dex/sushiswap-v3/token.js +23 -0
- package/build/dex/sushiswap-v3/token.js.map +1 -0
- package/build/dex/sushiswap-v3/types.d.ts +15 -0
- package/build/dex/sushiswap-v3/types.js +18 -0
- package/build/dex/sushiswap-v3/types.js.map +1 -0
- package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.d.ts +12 -0
- package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js +23 -0
- package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js.map +1 -0
- package/build/dex/{hello → woo-fi}/config.d.ts +1 -1
- package/build/dex/woo-fi/config.js +141 -0
- package/build/dex/woo-fi/config.js.map +1 -0
- package/build/dex/woo-fi/constants.d.ts +5 -0
- package/build/dex/woo-fi/constants.js +20 -0
- package/build/dex/woo-fi/constants.js.map +1 -0
- package/build/dex/woo-fi/types.d.ts +48 -0
- package/build/dex/{hello → woo-fi}/types.js.map +1 -1
- package/build/dex/woo-fi/woo-fi-decimal-math.d.ts +14 -0
- package/build/dex/woo-fi/woo-fi-decimal-math.js +42 -0
- package/build/dex/woo-fi/woo-fi-decimal-math.js.map +1 -0
- package/build/dex/woo-fi/woo-fi-math.d.ts +31 -0
- package/build/dex/woo-fi/woo-fi-math.js +300 -0
- package/build/dex/woo-fi/woo-fi-math.js.map +1 -0
- package/build/dex/woo-fi/woo-fi.d.ts +65 -0
- package/build/dex/woo-fi/woo-fi.js +480 -0
- package/build/dex/woo-fi/woo-fi.js.map +1 -0
- package/build/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/abi/dexalot/DexalotMainnetRFQ.json +952 -0
- package/src/config.ts +5 -2
- package/src/dex/dexalot/config.ts +18 -0
- package/src/dex/dexalot/constants.ts +29 -0
- package/src/dex/dexalot/dexalot-e2e.test.ts +192 -0
- package/src/dex/dexalot/dexalot-integration.test.ts +188 -0
- package/src/dex/dexalot/dexalot.ts +998 -0
- package/src/dex/dexalot/rate-fetcher.ts +197 -0
- package/src/dex/dexalot/types.ts +131 -0
- package/src/dex/dexalot/validators.ts +46 -0
- package/src/dex/idex.ts +2 -0
- package/src/dex/index.ts +2 -0
- package/src/types.ts +1 -0
- package/tests/constants-e2e.ts +2 -2
- package/build/dex/hello/config.js +0 -15
- package/build/dex/hello/config.js.map +0 -1
- package/build/dex/hello/hello-pool.d.ts +0 -39
- package/build/dex/hello/hello-pool.js +0 -64
- package/build/dex/hello/hello-pool.js.map +0 -1
- package/build/dex/hello/hello.d.ts +0 -37
- package/build/dex/hello/hello.js +0 -126
- package/build/dex/hello/hello.js.map +0 -1
- package/build/dex/hello/types.d.ts +0 -6
- package/build/dex/my-test-dex/config.js +0 -15
- package/build/dex/my-test-dex/config.js.map +0 -1
- package/build/dex/my-test-dex/my-test-dex-pool.d.ts +0 -39
- package/build/dex/my-test-dex/my-test-dex-pool.js +0 -64
- package/build/dex/my-test-dex/my-test-dex-pool.js.map +0 -1
- package/build/dex/my-test-dex/my-test-dex.d.ts +0 -37
- package/build/dex/my-test-dex/my-test-dex.js +0 -126
- package/build/dex/my-test-dex/my-test-dex.js.map +0 -1
- package/build/dex/my-test-dex/types.d.ts +0 -6
- /package/build/dex/{hello → pancakeswap-v3}/types.js +0 -0
- /package/build/dex/{my-test-dex → woo-fi}/types.js +0 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { IDexHelper } from '../../dex-helper';
|
|
2
|
+
import { Fetcher } from '../../lib/fetcher/fetcher';
|
|
3
|
+
import { validateAndCast } from '../../lib/validators';
|
|
4
|
+
import { Logger, Token } from '../../types';
|
|
5
|
+
import {
|
|
6
|
+
DexalotRateFetcherConfig,
|
|
7
|
+
DexalotPairsResponse,
|
|
8
|
+
PairDataMap,
|
|
9
|
+
DexalotPricesResponse,
|
|
10
|
+
PriceDataMap,
|
|
11
|
+
DexalotBlacklistResponse,
|
|
12
|
+
} from './types';
|
|
13
|
+
import {
|
|
14
|
+
pricesResponseValidator,
|
|
15
|
+
pairsResponseValidator,
|
|
16
|
+
blacklistResponseValidator,
|
|
17
|
+
} from './validators';
|
|
18
|
+
import { Network } from '../../constants';
|
|
19
|
+
|
|
20
|
+
export class RateFetcher {
|
|
21
|
+
private pairsFetcher: Fetcher<DexalotPairsResponse>;
|
|
22
|
+
private pairsCacheKey: string;
|
|
23
|
+
private pairsCacheTTL: number;
|
|
24
|
+
|
|
25
|
+
private rateFetcher: Fetcher<DexalotPricesResponse>;
|
|
26
|
+
private pricesCacheKey: string;
|
|
27
|
+
private pricesCacheTTL: number;
|
|
28
|
+
|
|
29
|
+
private tokensAddrCacheKey: string;
|
|
30
|
+
private tokensCacheKey: string;
|
|
31
|
+
private tokensCacheTTL: number;
|
|
32
|
+
|
|
33
|
+
private blacklistFetcher: Fetcher<DexalotBlacklistResponse>;
|
|
34
|
+
private blacklistCacheKey: string;
|
|
35
|
+
private blacklistCacheTTL: number;
|
|
36
|
+
|
|
37
|
+
constructor(
|
|
38
|
+
private dexHelper: IDexHelper,
|
|
39
|
+
private dexKey: string,
|
|
40
|
+
private network: Network,
|
|
41
|
+
private logger: Logger,
|
|
42
|
+
config: DexalotRateFetcherConfig,
|
|
43
|
+
) {
|
|
44
|
+
this.pairsCacheKey = config.rateConfig.pairsCacheKey;
|
|
45
|
+
this.pairsCacheTTL = config.rateConfig.pairsCacheTTLSecs;
|
|
46
|
+
this.pricesCacheKey = config.rateConfig.pricesCacheKey;
|
|
47
|
+
this.pricesCacheTTL = config.rateConfig.pricesCacheTTLSecs;
|
|
48
|
+
this.tokensAddrCacheKey = config.rateConfig.tokensAddrCacheKey;
|
|
49
|
+
this.tokensCacheKey = config.rateConfig.tokensCacheKey;
|
|
50
|
+
this.tokensCacheTTL = config.rateConfig.tokensCacheTTLSecs;
|
|
51
|
+
this.blacklistCacheKey = config.rateConfig.blacklistCacheKey;
|
|
52
|
+
this.blacklistCacheTTL = config.rateConfig.blacklistCacheTTLSecs;
|
|
53
|
+
|
|
54
|
+
this.pairsFetcher = new Fetcher<DexalotPairsResponse>(
|
|
55
|
+
dexHelper.httpRequest,
|
|
56
|
+
{
|
|
57
|
+
info: {
|
|
58
|
+
requestOptions: config.rateConfig.pairsReqParams,
|
|
59
|
+
caster: (data: unknown) => {
|
|
60
|
+
return validateAndCast<DexalotPairsResponse>(
|
|
61
|
+
data,
|
|
62
|
+
pairsResponseValidator,
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
handler: this.handlePairsResponse.bind(this),
|
|
67
|
+
},
|
|
68
|
+
config.rateConfig.pairsIntervalMs,
|
|
69
|
+
logger,
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
this.rateFetcher = new Fetcher<DexalotPricesResponse>(
|
|
73
|
+
dexHelper.httpRequest,
|
|
74
|
+
{
|
|
75
|
+
info: {
|
|
76
|
+
requestOptions: config.rateConfig.pricesReqParams,
|
|
77
|
+
caster: (data: unknown) => {
|
|
78
|
+
return validateAndCast<DexalotPricesResponse>(
|
|
79
|
+
data,
|
|
80
|
+
pricesResponseValidator,
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
handler: this.handleRatesResponse.bind(this),
|
|
85
|
+
},
|
|
86
|
+
config.rateConfig.pricesIntervalMs,
|
|
87
|
+
logger,
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
this.blacklistFetcher = new Fetcher<DexalotBlacklistResponse>(
|
|
91
|
+
dexHelper.httpRequest,
|
|
92
|
+
{
|
|
93
|
+
info: {
|
|
94
|
+
requestOptions: config.rateConfig.blacklistReqParams,
|
|
95
|
+
caster: (data: unknown) => {
|
|
96
|
+
return validateAndCast<DexalotBlacklistResponse>(
|
|
97
|
+
data,
|
|
98
|
+
blacklistResponseValidator,
|
|
99
|
+
);
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
handler: this.handleBlacklistResponse.bind(this),
|
|
103
|
+
},
|
|
104
|
+
config.rateConfig.blacklistIntervalMs,
|
|
105
|
+
logger,
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
start() {
|
|
110
|
+
this.pairsFetcher.startPolling();
|
|
111
|
+
this.rateFetcher.startPolling();
|
|
112
|
+
this.blacklistFetcher.startPolling();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
stop() {
|
|
116
|
+
this.pairsFetcher.stopPolling();
|
|
117
|
+
this.rateFetcher.stopPolling();
|
|
118
|
+
this.blacklistFetcher.stopPolling();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
private handlePairsResponse(resp: DexalotPairsResponse): void {
|
|
122
|
+
const pairs = resp;
|
|
123
|
+
const dexPairs: PairDataMap = {};
|
|
124
|
+
const tokenMap: { [address: string]: Token } = {};
|
|
125
|
+
const tokenAddrMap: { [symbol: string]: string } = {};
|
|
126
|
+
Object.keys(pairs).forEach(pair => {
|
|
127
|
+
dexPairs[pair.toLowerCase()] = pairs[pair];
|
|
128
|
+
tokenAddrMap[pairs[pair].base.toLowerCase()] =
|
|
129
|
+
pairs[pair].baseAddress.toLowerCase();
|
|
130
|
+
tokenAddrMap[pairs[pair].quote.toLowerCase()] =
|
|
131
|
+
pairs[pair].quoteAddress.toLowerCase();
|
|
132
|
+
tokenMap[pairs[pair].baseAddress.toLowerCase()] = {
|
|
133
|
+
address: pairs[pair].baseAddress.toLowerCase(),
|
|
134
|
+
symbol: pairs[pair].base,
|
|
135
|
+
decimals: pairs[pair].baseDecimals,
|
|
136
|
+
};
|
|
137
|
+
tokenMap[pairs[pair].quoteAddress.toLowerCase()] = {
|
|
138
|
+
address: pairs[pair].quoteAddress.toLowerCase(),
|
|
139
|
+
symbol: pairs[pair].quote,
|
|
140
|
+
decimals: pairs[pair].quoteDecimals,
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
this.dexHelper.cache.setex(
|
|
145
|
+
this.dexKey,
|
|
146
|
+
this.network,
|
|
147
|
+
this.pairsCacheKey,
|
|
148
|
+
this.pairsCacheTTL,
|
|
149
|
+
JSON.stringify(dexPairs),
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
this.dexHelper.cache.setex(
|
|
153
|
+
this.dexKey,
|
|
154
|
+
this.network,
|
|
155
|
+
this.tokensCacheKey,
|
|
156
|
+
this.tokensCacheTTL,
|
|
157
|
+
JSON.stringify(tokenMap),
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
this.dexHelper.cache.setex(
|
|
161
|
+
this.dexKey,
|
|
162
|
+
this.network,
|
|
163
|
+
this.tokensAddrCacheKey,
|
|
164
|
+
this.tokensCacheTTL,
|
|
165
|
+
JSON.stringify(tokenAddrMap),
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
private handleRatesResponse(resp: DexalotPricesResponse): void {
|
|
170
|
+
const { prices } = resp;
|
|
171
|
+
const dexPrices: PriceDataMap = {};
|
|
172
|
+
Object.keys(prices).forEach(pair => {
|
|
173
|
+
dexPrices[pair.toLowerCase()] = prices[pair];
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
this.dexHelper.cache.setex(
|
|
177
|
+
this.dexKey,
|
|
178
|
+
this.network,
|
|
179
|
+
this.pricesCacheKey,
|
|
180
|
+
this.pricesCacheTTL,
|
|
181
|
+
JSON.stringify(dexPrices),
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
private async handleBlacklistResponse(
|
|
186
|
+
resp: DexalotBlacklistResponse,
|
|
187
|
+
): Promise<void> {
|
|
188
|
+
const { blacklist } = resp;
|
|
189
|
+
this.dexHelper.cache.setex(
|
|
190
|
+
this.dexKey,
|
|
191
|
+
this.network,
|
|
192
|
+
this.blacklistCacheKey,
|
|
193
|
+
this.blacklistCacheTTL,
|
|
194
|
+
JSON.stringify(blacklist.map((item) => item.toLowerCase())),
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { RequestHeaders } from '../../dex-helper';
|
|
2
|
+
import { Token } from '../../types';
|
|
3
|
+
import { Method } from '../../dex-helper/irequest-wrapper';
|
|
4
|
+
|
|
5
|
+
type RFQOrder = {
|
|
6
|
+
nonceAndMeta: string;
|
|
7
|
+
expiry: number;
|
|
8
|
+
makerAsset: string;
|
|
9
|
+
takerAsset: string;
|
|
10
|
+
maker: string;
|
|
11
|
+
taker: string;
|
|
12
|
+
makerAmount: string;
|
|
13
|
+
takerAmount: string;
|
|
14
|
+
signature?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type RFQResponse = {
|
|
18
|
+
order: RFQOrder;
|
|
19
|
+
signature: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type RFQResponseError = {
|
|
23
|
+
Reason: string;
|
|
24
|
+
ReasonCode: string;
|
|
25
|
+
Success: boolean;
|
|
26
|
+
RetryAfter?: number;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type DexalotData = {
|
|
30
|
+
quoteData?: RFQOrder;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type DexParams = {
|
|
34
|
+
mainnetRFQAddress: string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export enum ClobSide {
|
|
38
|
+
BID = 'BID',
|
|
39
|
+
ASK = 'ASK',
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class DexalotRfqError extends Error {}
|
|
43
|
+
|
|
44
|
+
export type PairData = {
|
|
45
|
+
base: string;
|
|
46
|
+
quote: string;
|
|
47
|
+
liquidityUSD: number;
|
|
48
|
+
isSrcBase?: boolean;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type PairDataMap = {
|
|
52
|
+
[pair: string]: PairData;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type PairDataResp = {
|
|
56
|
+
base: string;
|
|
57
|
+
quote: string;
|
|
58
|
+
liquidityUSD: number;
|
|
59
|
+
baseAddress: string;
|
|
60
|
+
quoteAddress: string;
|
|
61
|
+
baseDecimals: number;
|
|
62
|
+
quoteDecimals: number;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export type DexalotPairsResponse = {
|
|
66
|
+
[pair: string]: PairDataResp;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
type PriceData = {
|
|
70
|
+
bids: string[][];
|
|
71
|
+
asks: string[][];
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export type PriceDataMap = {
|
|
75
|
+
[pair: string]: PriceData;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export type DexalotPricesResponse = {
|
|
79
|
+
prices: PriceDataMap;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export type TokenAddrDataMap = {
|
|
83
|
+
[symbol: string]: string;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export type TokenDataMap = {
|
|
87
|
+
[address: string]: Token;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export type DexalotBlacklistResponse = {
|
|
91
|
+
blacklist: string[];
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export type DexalotRateFetcherConfig = {
|
|
95
|
+
rateConfig: {
|
|
96
|
+
pairsReqParams: {
|
|
97
|
+
url: string;
|
|
98
|
+
headers?: RequestHeaders;
|
|
99
|
+
params?: any;
|
|
100
|
+
};
|
|
101
|
+
pricesReqParams: {
|
|
102
|
+
url: string;
|
|
103
|
+
headers?: RequestHeaders;
|
|
104
|
+
params?: any;
|
|
105
|
+
};
|
|
106
|
+
blacklistReqParams: {
|
|
107
|
+
url: string;
|
|
108
|
+
headers?: RequestHeaders;
|
|
109
|
+
params?: any;
|
|
110
|
+
};
|
|
111
|
+
pairsIntervalMs: number;
|
|
112
|
+
pricesIntervalMs: number;
|
|
113
|
+
blacklistIntervalMs: number;
|
|
114
|
+
pairsCacheKey: string;
|
|
115
|
+
pricesCacheKey: string;
|
|
116
|
+
tokensAddrCacheKey: string;
|
|
117
|
+
tokensCacheKey: string;
|
|
118
|
+
blacklistCacheKey: string;
|
|
119
|
+
blacklistCacheTTLSecs: number;
|
|
120
|
+
pairsCacheTTLSecs: number;
|
|
121
|
+
pricesCacheTTLSecs: number;
|
|
122
|
+
tokensCacheTTLSecs: number;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export type DexalotAPIParameters = {
|
|
127
|
+
url: string;
|
|
128
|
+
headers?: RequestHeaders;
|
|
129
|
+
params?: any;
|
|
130
|
+
method?: Method;
|
|
131
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import joi from 'joi';
|
|
2
|
+
|
|
3
|
+
const pairValidator = joi.object({
|
|
4
|
+
base: joi.string().min(1).required(),
|
|
5
|
+
quote: joi.string().min(1).required(),
|
|
6
|
+
liquidityUSD: joi.number().min(0).required(),
|
|
7
|
+
baseAddress: joi.string().min(1).required(),
|
|
8
|
+
quoteAddress: joi.string().min(1).required(),
|
|
9
|
+
baseDecimals: joi.number().min(0).required(),
|
|
10
|
+
quoteDecimals: joi.number().min(0).required(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const pairsResponseValidator = joi
|
|
14
|
+
.object()
|
|
15
|
+
.pattern(joi.string(), pairValidator);
|
|
16
|
+
|
|
17
|
+
const orderbookRecordValidator = joi
|
|
18
|
+
.array()
|
|
19
|
+
.items(joi.string().min(1))
|
|
20
|
+
.length(2);
|
|
21
|
+
|
|
22
|
+
const orderbookValidator = joi.object({
|
|
23
|
+
bids: joi.array().items(orderbookRecordValidator).required(),
|
|
24
|
+
asks: joi.array().items(orderbookRecordValidator).required(),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const pricesResponseValidator = joi.object({
|
|
28
|
+
prices: joi.object().pattern(joi.string(), orderbookValidator),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const tokenValidator = joi.object({
|
|
32
|
+
symbol: joi.string().min(1).required(),
|
|
33
|
+
name: joi.string().min(1).required(),
|
|
34
|
+
description: joi.string().min(1).required(),
|
|
35
|
+
address: joi.string().min(1).required(),
|
|
36
|
+
decimals: joi.number().min(0).required(),
|
|
37
|
+
type: joi.string().min(1).required(),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export const tokensResponseValidator = joi.object({
|
|
41
|
+
tokens: joi.object().pattern(joi.string(), tokenValidator),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export const blacklistResponseValidator = joi.object({
|
|
45
|
+
blacklist: joi.array().items(joi.string().min(1)).required(),
|
|
46
|
+
});
|
package/src/dex/idex.ts
CHANGED
|
@@ -131,9 +131,11 @@ export interface IDexPricing<ExchangeData> {
|
|
|
131
131
|
blockNumber: number,
|
|
132
132
|
// list of pool identifiers to use for pricing, if undefined use all pools
|
|
133
133
|
limitPools?: string[],
|
|
134
|
+
|
|
134
135
|
// I don't like putting this as new params, but in order to not change interface
|
|
135
136
|
// across all integrations, done it like this
|
|
136
137
|
transferFees?: TransferFeeParams,
|
|
138
|
+
isFirstSwap?: boolean,
|
|
137
139
|
): Promise<ExchangePrices<ExchangeData> | null>;
|
|
138
140
|
|
|
139
141
|
// Returns estimated gas cost for calldata for DEX when used in multiSwap.
|
package/src/dex/index.ts
CHANGED
|
@@ -76,6 +76,7 @@ import { PancakeswapV3 } from './pancakeswap-v3/pancakeswap-v3';
|
|
|
76
76
|
import { Algebra } from './algebra/algebra';
|
|
77
77
|
import { QuickPerps } from './quick-perps/quick-perps';
|
|
78
78
|
import { NomiswapV2 } from './uniswap-v2/nomiswap-v2';
|
|
79
|
+
import { Dexalot } from './dexalot/dexalot';
|
|
79
80
|
|
|
80
81
|
const LegacyDexes = [
|
|
81
82
|
CurveV2,
|
|
@@ -102,6 +103,7 @@ const LegacyDexes = [
|
|
|
102
103
|
];
|
|
103
104
|
|
|
104
105
|
const Dexes = [
|
|
106
|
+
Dexalot,
|
|
105
107
|
CurveV1,
|
|
106
108
|
CurveFork,
|
|
107
109
|
Swerve,
|
package/src/types.ts
CHANGED
package/tests/constants-e2e.ts
CHANGED
|
@@ -1065,7 +1065,7 @@ export const Holders: {
|
|
|
1065
1065
|
BETS: '0x8cc2284c90d05578633418f9cde104f402375a65',
|
|
1066
1066
|
HATCHY: '0x14ec295ec8def851ec6e2959df872dd24e422631',
|
|
1067
1067
|
USDCe: '0x3a2434c698f8d79af1f5a9e43013157ca8b11a66',
|
|
1068
|
-
USDC: '
|
|
1068
|
+
USDC: '0x0d0707963952f2fba59dd06f2b425ace40b492fe',
|
|
1069
1069
|
USDTe: '0x84d34f4f83a87596cd3fb6887cff8f17bf5a7b83',
|
|
1070
1070
|
WETHe: '0xD291B51f7a1a1F4917D085F2a7731A447E4aF82D',
|
|
1071
1071
|
POPS: '0x5268c2331658cb0b2858cfa9db27d8f22f5434bc',
|
|
@@ -1081,7 +1081,7 @@ export const Holders: {
|
|
|
1081
1081
|
TSD: '0x691A89db352B72dDb249bFe16503494eC0D920A4',
|
|
1082
1082
|
THO: '0xc40d16c47394a506d451475c8a7c46c1175c1da1',
|
|
1083
1083
|
aAvaUSDT: '0x50B1Ba98Cf117c9682048D56628B294ebbAA4ec2',
|
|
1084
|
-
USDT: '
|
|
1084
|
+
USDT: '0x764fe7fb23f0f995c45faef5e32a4526f2028814',
|
|
1085
1085
|
aAvaWAVAX: '0x1B18Df70863636AEe4BfBAb6F7C70ceBCA9bA404',
|
|
1086
1086
|
oldFRAX: '0x4e3376018add04ebe4c46bf6f924ddec8c67aa7b',
|
|
1087
1087
|
newFRAX: '0x4e3376018add04ebe4c46bf6f924ddec8c67aa7b',
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Adapters = exports.HelloConfig = void 0;
|
|
4
|
-
const constants_1 = require("../../constants");
|
|
5
|
-
exports.HelloConfig = {
|
|
6
|
-
Hello: {
|
|
7
|
-
// TODO: complete me!
|
|
8
|
-
},
|
|
9
|
-
};
|
|
10
|
-
exports.Adapters = {
|
|
11
|
-
// TODO: add adapters for each chain
|
|
12
|
-
// This is an example to copy
|
|
13
|
-
[constants_1.Network.MAINNET]: { [constants_1.SwapSide.SELL]: [{ name: '', index: 0 }] },
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/hello/config.ts"],"names":[],"mappings":";;;AAEA,+CAAoD;AAEvC,QAAA,WAAW,GAA4B;IAClD,KAAK,EAAE;IACL,qBAAqB;KACtB;CACF,CAAC;AAEW,QAAA,QAAQ,GAAoC;IACvD,oCAAoC;IACpC,6BAA6B;IAC7B,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,oBAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE;CACjE,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Interface } from '@ethersproject/abi';
|
|
2
|
-
import { DeepReadonly } from 'ts-essentials';
|
|
3
|
-
import { Log, Logger } from '../../types';
|
|
4
|
-
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
5
|
-
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
6
|
-
import { PoolState } from './types';
|
|
7
|
-
export declare class HelloEventPool extends StatefulEventSubscriber<PoolState> {
|
|
8
|
-
readonly parentName: string;
|
|
9
|
-
protected network: number;
|
|
10
|
-
protected dexHelper: IDexHelper;
|
|
11
|
-
protected helloIface: Interface;
|
|
12
|
-
handlers: {
|
|
13
|
-
[event: string]: (event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>) => DeepReadonly<PoolState> | null;
|
|
14
|
-
};
|
|
15
|
-
logDecoder: (log: Log) => any;
|
|
16
|
-
addressesSubscribed: string[];
|
|
17
|
-
constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, helloIface?: Interface);
|
|
18
|
-
/**
|
|
19
|
-
* The function is called every time any of the subscribed
|
|
20
|
-
* addresses release log. The function accepts the current
|
|
21
|
-
* state, updates the state according to the log, and returns
|
|
22
|
-
* the updated state.
|
|
23
|
-
* @param state - Current state of event subscriber
|
|
24
|
-
* @param log - Log released by one of the subscribed addresses
|
|
25
|
-
* @returns Updates state of the event subscriber after the log
|
|
26
|
-
*/
|
|
27
|
-
protected processLog(state: DeepReadonly<PoolState>, log: Readonly<Log>): DeepReadonly<PoolState> | null;
|
|
28
|
-
/**
|
|
29
|
-
* The function generates state using on-chain calls. This
|
|
30
|
-
* function is called to regenerate state if the event based
|
|
31
|
-
* system fails to fetch events and the local state is no
|
|
32
|
-
* more correct.
|
|
33
|
-
* @param blockNumber - Blocknumber for which the state should
|
|
34
|
-
* should be generated
|
|
35
|
-
* @returns state of the event subscriber at blocknumber
|
|
36
|
-
*/
|
|
37
|
-
generateState(blockNumber: number): Promise<DeepReadonly<PoolState>>;
|
|
38
|
-
handleMyEvent(event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>): DeepReadonly<PoolState> | null;
|
|
39
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HelloEventPool = void 0;
|
|
4
|
-
const abi_1 = require("@ethersproject/abi");
|
|
5
|
-
const utils_1 = require("../../utils");
|
|
6
|
-
const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
|
|
7
|
-
class HelloEventPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
8
|
-
constructor(parentName, network, dexHelper, logger, helloIface = new abi_1.Interface('' /* TODO: Import and put here Hello ABI */)) {
|
|
9
|
-
// TODO: Add pool name
|
|
10
|
-
super(parentName, 'POOL_NAME', dexHelper, logger);
|
|
11
|
-
this.parentName = parentName;
|
|
12
|
-
this.network = network;
|
|
13
|
-
this.dexHelper = dexHelper;
|
|
14
|
-
this.helloIface = helloIface;
|
|
15
|
-
this.handlers = {};
|
|
16
|
-
// TODO: make logDecoder decode logs that
|
|
17
|
-
this.logDecoder = (log) => this.helloIface.parseLog(log);
|
|
18
|
-
this.addressesSubscribed = [
|
|
19
|
-
/* subscribed addresses */
|
|
20
|
-
];
|
|
21
|
-
// Add handlers
|
|
22
|
-
this.handlers['myEvent'] = this.handleMyEvent.bind(this);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* The function is called every time any of the subscribed
|
|
26
|
-
* addresses release log. The function accepts the current
|
|
27
|
-
* state, updates the state according to the log, and returns
|
|
28
|
-
* the updated state.
|
|
29
|
-
* @param state - Current state of event subscriber
|
|
30
|
-
* @param log - Log released by one of the subscribed addresses
|
|
31
|
-
* @returns Updates state of the event subscriber after the log
|
|
32
|
-
*/
|
|
33
|
-
processLog(state, log) {
|
|
34
|
-
try {
|
|
35
|
-
const event = this.logDecoder(log);
|
|
36
|
-
if (event.name in this.handlers) {
|
|
37
|
-
return this.handlers[event.name](event, state, log);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
(0, utils_1.catchParseLogError)(e, this.logger);
|
|
42
|
-
}
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* The function generates state using on-chain calls. This
|
|
47
|
-
* function is called to regenerate state if the event based
|
|
48
|
-
* system fails to fetch events and the local state is no
|
|
49
|
-
* more correct.
|
|
50
|
-
* @param blockNumber - Blocknumber for which the state should
|
|
51
|
-
* should be generated
|
|
52
|
-
* @returns state of the event subscriber at blocknumber
|
|
53
|
-
*/
|
|
54
|
-
async generateState(blockNumber) {
|
|
55
|
-
// TODO: complete me!
|
|
56
|
-
return {};
|
|
57
|
-
}
|
|
58
|
-
// Its just a dummy example
|
|
59
|
-
handleMyEvent(event, state, log) {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
exports.HelloEventPool = HelloEventPool;
|
|
64
|
-
//# sourceMappingURL=hello-pool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hello-pool.js","sourceRoot":"","sources":["../../../src/dex/hello/hello-pool.ts"],"names":[],"mappings":";;;AAAA,4CAA+C;AAG/C,uCAAiD;AACjD,+EAA0E;AAI1E,MAAa,cAAe,SAAQ,mDAAkC;IAapE,YACW,UAAkB,EACjB,OAAe,EACf,SAAqB,EAC/B,MAAc,EACJ,aAAa,IAAI,eAAS,CAClC,EAAE,CAAC,yCAAyC,CAC7C;QAED,sBAAsB;QACtB,KAAK,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QATzC,eAAU,GAAV,UAAU,CAAQ;QACjB,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAY;QAErB,eAAU,GAAV,UAAU,CAEnB;QAnBH,aAAQ,GAMJ,EAAE,CAAC;QAkBL,yCAAyC;QACzC,IAAI,CAAC,UAAU,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC9D,IAAI,CAAC,mBAAmB,GAAG;QACzB,0BAA0B;SAC3B,CAAC;QAEF,eAAe;QACf,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;;OAQG;IACO,UAAU,CAClB,KAA8B,EAC9B,GAAkB;QAElB,IAAI;YACF,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YACnC,IAAI,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;gBAC/B,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;aACrD;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAA,0BAAkB,EAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;SACpC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,aAAa,CAAC,WAAmB;QACrC,qBAAqB;QACrB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,2BAA2B;IAC3B,aAAa,CACX,KAAU,EACV,KAA8B,EAC9B,GAAkB;QAElB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAlFD,wCAkFC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { AsyncOrSync } from 'ts-essentials';
|
|
2
|
-
import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, SimpleExchangeParam, PoolLiquidity, Logger } from '../../types';
|
|
3
|
-
import { SwapSide, Network } from '../../constants';
|
|
4
|
-
import { IDex } from '../../dex/idex';
|
|
5
|
-
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
6
|
-
import { HelloData } from './types';
|
|
7
|
-
import { SimpleExchange } from '../simple-exchange';
|
|
8
|
-
import { HelloEventPool } from './hello-pool';
|
|
9
|
-
export declare class Hello extends SimpleExchange implements IDex<HelloData> {
|
|
10
|
-
readonly network: Network;
|
|
11
|
-
readonly dexKey: string;
|
|
12
|
-
readonly dexHelper: IDexHelper;
|
|
13
|
-
protected adapters: import("../../types").AdapterMappings;
|
|
14
|
-
protected eventPools: HelloEventPool;
|
|
15
|
-
readonly hasConstantPriceLargeAmounts = false;
|
|
16
|
-
readonly needWrapNative = true;
|
|
17
|
-
readonly isFeeOnTransferSupported = false;
|
|
18
|
-
static dexKeysWithNetwork: {
|
|
19
|
-
key: string;
|
|
20
|
-
networks: Network[];
|
|
21
|
-
}[];
|
|
22
|
-
logger: Logger;
|
|
23
|
-
constructor(network: Network, dexKey: string, dexHelper: IDexHelper, adapters?: import("../../types").AdapterMappings);
|
|
24
|
-
initializePricing(blockNumber: number): Promise<void>;
|
|
25
|
-
getAdapters(side: SwapSide): {
|
|
26
|
-
name: string;
|
|
27
|
-
index: number;
|
|
28
|
-
}[] | null;
|
|
29
|
-
getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
|
|
30
|
-
getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<HelloData>>;
|
|
31
|
-
getCalldataGasCost(poolPrices: PoolPrices<HelloData>): number | number[];
|
|
32
|
-
getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: HelloData, side: SwapSide): AdapterExchangeParam;
|
|
33
|
-
getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: HelloData, side: SwapSide): Promise<SimpleExchangeParam>;
|
|
34
|
-
updatePoolState(): Promise<void>;
|
|
35
|
-
getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
|
|
36
|
-
releaseResources(): AsyncOrSync<void>;
|
|
37
|
-
}
|