@paraswap/dex-lib 3.8.38 → 3.8.39-1701-1507-1721

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.
Files changed (198) hide show
  1. package/build/abi/USDM.json +807 -0
  2. package/build/abi/bebop/BebopSettlement.abi.json +2137 -0
  3. package/build/abi/wUSDM.json +757 -0
  4. package/build/config.js +16 -9
  5. package/build/config.js.map +1 -1
  6. package/build/dex/aave-v2/aave-v2.d.ts +1 -0
  7. package/build/dex/aave-v2/aave-v2.js +1 -0
  8. package/build/dex/aave-v2/aave-v2.js.map +1 -1
  9. package/build/dex/aave-v3/aave-v3.d.ts +1 -0
  10. package/build/dex/aave-v3/aave-v3.js +1 -0
  11. package/build/dex/aave-v3/aave-v3.js.map +1 -1
  12. package/build/dex/aave-v3-stata/aave-v3-stata.d.ts +1 -0
  13. package/build/dex/aave-v3-stata/aave-v3-stata.js +1 -0
  14. package/build/dex/aave-v3-stata/aave-v3-stata.js.map +1 -1
  15. package/build/dex/bancor/bancor.d.ts +1 -0
  16. package/build/dex/bancor/bancor.js +1 -0
  17. package/build/dex/bancor/bancor.js.map +1 -1
  18. package/build/dex/bebop/bebop.d.ts +55 -0
  19. package/build/dex/bebop/bebop.js +524 -0
  20. package/build/dex/bebop/bebop.js.map +1 -0
  21. package/build/dex/bebop/config.d.ts +3 -0
  22. package/build/dex/bebop/config.js +38 -0
  23. package/build/dex/bebop/config.js.map +1 -0
  24. package/build/dex/bebop/constants.d.ts +9 -0
  25. package/build/dex/bebop/constants.js +13 -0
  26. package/build/dex/bebop/constants.js.map +1 -0
  27. package/build/dex/bebop/rate-fetcher.d.ts +22 -0
  28. package/build/dex/bebop/rate-fetcher.js +80 -0
  29. package/build/dex/bebop/rate-fetcher.js.map +1 -0
  30. package/build/dex/bebop/types.d.ts +76 -0
  31. package/build/dex/bebop/types.js +3 -0
  32. package/build/dex/bebop/types.js.map +1 -0
  33. package/build/dex/bebop/validators.d.ts +4 -0
  34. package/build/dex/bebop/validators.js +42 -0
  35. package/build/dex/bebop/validators.js.map +1 -0
  36. package/build/dex/bebop/websocket-fetcher.d.ts +35 -0
  37. package/build/dex/bebop/websocket-fetcher.js +87 -0
  38. package/build/dex/bebop/websocket-fetcher.js.map +1 -0
  39. package/build/dex/compound/compound.d.ts +1 -0
  40. package/build/dex/compound/compound.js +1 -0
  41. package/build/dex/compound/compound.js.map +1 -1
  42. package/build/dex/curve-v1/curve-v1.d.ts +1 -0
  43. package/build/dex/curve-v1/curve-v1.js +1 -0
  44. package/build/dex/curve-v1/curve-v1.js.map +1 -1
  45. package/build/dex/dodo-v1/dodo-v1.d.ts +1 -0
  46. package/build/dex/dodo-v1/dodo-v1.js +1 -0
  47. package/build/dex/dodo-v1/dodo-v1.js.map +1 -1
  48. package/build/dex/hashflow/hashflow.d.ts +6 -4
  49. package/build/dex/hashflow/hashflow.js +183 -29
  50. package/build/dex/hashflow/hashflow.js.map +1 -1
  51. package/build/dex/hashflow/types.d.ts +2 -0
  52. package/build/dex/hashflow/types.js.map +1 -1
  53. package/build/dex/idex.d.ts +8 -1
  54. package/build/dex/index.js +2 -0
  55. package/build/dex/index.js.map +1 -1
  56. package/build/dex/jarvis-v6/jarvis-v6.d.ts +1 -0
  57. package/build/dex/jarvis-v6/jarvis-v6.js +1 -0
  58. package/build/dex/jarvis-v6/jarvis-v6.js.map +1 -1
  59. package/build/dex/lido/lido.d.ts +1 -0
  60. package/build/dex/lido/lido.js +1 -0
  61. package/build/dex/lido/lido.js.map +1 -1
  62. package/build/dex/lite-psm/lite-psm.d.ts +1 -0
  63. package/build/dex/lite-psm/lite-psm.js +1 -0
  64. package/build/dex/lite-psm/lite-psm.js.map +1 -1
  65. package/build/dex/maker-psm/maker-psm.d.ts +1 -0
  66. package/build/dex/maker-psm/maker-psm.js +1 -0
  67. package/build/dex/maker-psm/maker-psm.js.map +1 -1
  68. package/build/dex/nerve/nerve.d.ts +1 -0
  69. package/build/dex/nerve/nerve.js +1 -0
  70. package/build/dex/nerve/nerve.js.map +1 -1
  71. package/build/dex/polygon-migrator/polygon-migrator.d.ts +1 -0
  72. package/build/dex/polygon-migrator/polygon-migrator.js +1 -0
  73. package/build/dex/polygon-migrator/polygon-migrator.js.map +1 -1
  74. package/build/dex/simple-exchange.d.ts +3 -1
  75. package/build/dex/simple-exchange.js +1 -0
  76. package/build/dex/simple-exchange.js.map +1 -1
  77. package/build/dex/smoothy/smoothy.d.ts +1 -0
  78. package/build/dex/smoothy/smoothy.js +1 -0
  79. package/build/dex/smoothy/smoothy.js.map +1 -1
  80. package/build/dex/spark/config.js +8 -0
  81. package/build/dex/spark/config.js.map +1 -1
  82. package/build/dex/spark/spark.d.ts +4 -1
  83. package/build/dex/spark/spark.js +20 -15
  84. package/build/dex/spark/spark.js.map +1 -1
  85. package/build/dex/spark/types.d.ts +9 -0
  86. package/build/dex/spark/types.js +8 -1
  87. package/build/dex/spark/types.js.map +1 -1
  88. package/build/dex/stable-pool/stable-pool.d.ts +3 -2
  89. package/build/dex/stable-pool/stable-pool.js +2 -1
  90. package/build/dex/stable-pool/stable-pool.js.map +1 -1
  91. package/build/dex/swaap-v2/swaap-v2.d.ts +5 -3
  92. package/build/dex/swaap-v2/swaap-v2.js +112 -21
  93. package/build/dex/swaap-v2/swaap-v2.js.map +1 -1
  94. package/build/dex/swaap-v2/types.d.ts +2 -0
  95. package/build/dex/swaap-v2/types.js.map +1 -1
  96. package/build/dex/trader-joe-v2.1/base.d.ts +1 -0
  97. package/build/dex/trader-joe-v2.1/base.js +1 -0
  98. package/build/dex/trader-joe-v2.1/base.js.map +1 -1
  99. package/build/dex/weth/weth.d.ts +1 -0
  100. package/build/dex/weth/weth.js +1 -0
  101. package/build/dex/weth/weth.js.map +1 -1
  102. package/build/dex/woo-fi-v2/woo-fi-v2-pool.d.ts +2 -2
  103. package/build/dex/woo-fi-v2/woo-fi-v2-pool.js +30 -9
  104. package/build/dex/woo-fi-v2/woo-fi-v2-pool.js.map +1 -1
  105. package/build/dex/woo-fi-v2/woo-fi-v2.js +1 -1
  106. package/build/dex/woo-fi-v2/woo-fi-v2.js.map +1 -1
  107. package/build/dex/wusdm/config.d.ts +3 -0
  108. package/build/dex/wusdm/config.js +29 -0
  109. package/build/dex/wusdm/config.js.map +1 -0
  110. package/build/dex/wusdm/types.d.ts +10 -0
  111. package/build/dex/wusdm/types.js +3 -0
  112. package/build/dex/wusdm/types.js.map +1 -0
  113. package/build/dex/wusdm/wusdm.d.ts +39 -0
  114. package/build/dex/wusdm/wusdm.js +212 -0
  115. package/build/dex/wusdm/wusdm.js.map +1 -0
  116. package/build/executor/Executor01BytecodeBuilder.d.ts +3 -3
  117. package/build/executor/Executor01BytecodeBuilder.js +65 -16
  118. package/build/executor/Executor01BytecodeBuilder.js.map +1 -1
  119. package/build/executor/Executor02BytecodeBuilder.d.ts +4 -4
  120. package/build/executor/Executor02BytecodeBuilder.js +65 -18
  121. package/build/executor/Executor02BytecodeBuilder.js.map +1 -1
  122. package/build/executor/Executor03BytecodeBuilder.d.ts +2 -2
  123. package/build/executor/Executor03BytecodeBuilder.js +52 -8
  124. package/build/executor/Executor03BytecodeBuilder.js.map +1 -1
  125. package/build/executor/ExecutorBytecodeBuilder.d.ts +5 -4
  126. package/build/executor/ExecutorBytecodeBuilder.js +4 -4
  127. package/build/executor/ExecutorBytecodeBuilder.js.map +1 -1
  128. package/build/executor/ExecutorDetector.js +2 -1
  129. package/build/executor/ExecutorDetector.js.map +1 -1
  130. package/build/executor/types.d.ts +1 -0
  131. package/build/executor/types.js +1 -0
  132. package/build/executor/types.js.map +1 -1
  133. package/build/generic-swap-transaction-builder.d.ts +2 -0
  134. package/build/generic-swap-transaction-builder.js +49 -11
  135. package/build/generic-swap-transaction-builder.js.map +1 -1
  136. package/build/implementations/local-paraswap-sdk.js +3 -1
  137. package/build/implementations/local-paraswap-sdk.js.map +1 -1
  138. package/build/lib/fetcher/wsFetcher.d.ts +35 -0
  139. package/build/lib/fetcher/wsFetcher.js +87 -0
  140. package/build/lib/fetcher/wsFetcher.js.map +1 -0
  141. package/build/router/simpleswap.js +51 -13
  142. package/build/router/simpleswap.js.map +1 -1
  143. package/build/types.d.ts +2 -0
  144. package/package.json +4 -2
  145. package/src/abi/bebop/BebopSettlement.abi.json +2137 -0
  146. package/src/config.ts +17 -9
  147. package/src/dex/aave-v2/aave-v2.ts +2 -0
  148. package/src/dex/aave-v3/aave-v3.ts +2 -0
  149. package/src/dex/aave-v3-stata/aave-v3-stata.ts +2 -0
  150. package/src/dex/bancor/bancor.ts +2 -0
  151. package/src/dex/bebop/bebop-e2e.test.ts +195 -0
  152. package/src/dex/bebop/bebop-integration.test.ts +170 -0
  153. package/src/dex/bebop/bebop.ts +732 -0
  154. package/src/dex/bebop/config.ts +37 -0
  155. package/src/dex/bebop/constants.ts +9 -0
  156. package/src/dex/bebop/rate-fetcher.ts +138 -0
  157. package/src/dex/bebop/types.ts +81 -0
  158. package/src/dex/bebop/validators.ts +43 -0
  159. package/src/dex/compound/compound.ts +2 -0
  160. package/src/dex/curve-v1/curve-v1.ts +2 -0
  161. package/src/dex/dodo-v1/dodo-v1.ts +2 -0
  162. package/src/dex/hashflow/hashflow-e2e.test.ts +281 -28
  163. package/src/dex/hashflow/hashflow.ts +285 -54
  164. package/src/dex/hashflow/types.ts +2 -0
  165. package/src/dex/idex.ts +18 -1
  166. package/src/dex/index.ts +2 -0
  167. package/src/dex/jarvis-v6/jarvis-v6.ts +2 -0
  168. package/src/dex/lido/lido.ts +2 -0
  169. package/src/dex/lite-psm/lite-psm.ts +2 -0
  170. package/src/dex/maker-psm/maker-psm.ts +2 -0
  171. package/src/dex/nerve/nerve.ts +2 -0
  172. package/src/dex/polygon-migrator/polygon-migrator.ts +2 -0
  173. package/src/dex/simple-exchange.ts +4 -2
  174. package/src/dex/smoothy/smoothy.ts +2 -0
  175. package/src/dex/spark/config.ts +8 -1
  176. package/src/dex/spark/spark.ts +27 -18
  177. package/src/dex/spark/types.ts +10 -0
  178. package/src/dex/stable-pool/stable-pool.ts +4 -1
  179. package/src/dex/swaap-v2/swaap-v2-e2e.test.ts +13 -13
  180. package/src/dex/swaap-v2/swaap-v2.ts +217 -32
  181. package/src/dex/swaap-v2/types.ts +2 -0
  182. package/src/dex/trader-joe-v2.1/base.ts +2 -0
  183. package/src/dex/weth/weth.ts +2 -0
  184. package/src/dex/woo-fi-v2/woo-fi-v2-pool.ts +58 -27
  185. package/src/dex/woo-fi-v2/woo-fi-v2.ts +1 -2
  186. package/src/executor/Executor01BytecodeBuilder.ts +105 -11
  187. package/src/executor/Executor02BytecodeBuilder.ts +95 -8
  188. package/src/executor/Executor03BytecodeBuilder.ts +89 -5
  189. package/src/executor/ExecutorBytecodeBuilder.ts +6 -0
  190. package/src/executor/ExecutorDetector.ts +2 -1
  191. package/src/executor/types.ts +1 -0
  192. package/src/generic-swap-transaction-builder.ts +96 -24
  193. package/src/implementations/local-paraswap-sdk.ts +21 -10
  194. package/src/lib/fetcher/wsFetcher.ts +126 -0
  195. package/src/router/simpleswap.ts +94 -18
  196. package/src/types.ts +2 -0
  197. package/tests/constants-e2e.ts +2 -2
  198. package/tests/utils-e2e.ts +308 -2
@@ -0,0 +1,37 @@
1
+ import { DexParams } from './types';
2
+ import { DexConfigMap } from '../../types';
3
+ import { Network } from '../../constants';
4
+
5
+ export const BebopConfig: DexConfigMap<DexParams> = {
6
+ Bebop: {
7
+ [Network.MAINNET]: {
8
+ settlementAddress: '0xbbbbbBB520d69a9775E85b458C58c648259FAD5F',
9
+ chainName: 'ethereum',
10
+ middleTokens: [
11
+ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
12
+ '0xdAC17F958D2ee523a2206206994597C13D831ec7', // USDT
13
+ '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // WETH
14
+ ],
15
+ },
16
+ [Network.ARBITRUM]: {
17
+ settlementAddress: '0xbbbbbBB520d69a9775E85b458C58c648259FAD5F',
18
+ chainName: 'arbitrum',
19
+ middleTokens: [
20
+ '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', // USDC.e
21
+ '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', // USDC
22
+ '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9', // USDT
23
+ '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', // WETH
24
+ ],
25
+ },
26
+ [Network.BASE]: {
27
+ settlementAddress: '0xbbbbbBB520d69a9775E85b458C58c648259FAD5F',
28
+ chainName: 'base',
29
+ middleTokens: ['0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'],
30
+ },
31
+ [Network.OPTIMISM]: {
32
+ settlementAddress: '0xbbbbbBB520d69a9775E85b458C58c648259FAD5F',
33
+ chainName: 'optimism',
34
+ middleTokens: ['0x7F5c764cBc14f9669B88837ca1490cCa17c31607'],
35
+ },
36
+ },
37
+ };
@@ -0,0 +1,9 @@
1
+ export const BEBOP_INIT_TIMEOUT_MS = 5000;
2
+ export const BEBOP_PRICES_CACHE_TTL = 10;
3
+ export const BEBOP_TOKENS_CACHE_TTL = 60;
4
+ export const BEBOP_TOKENS_POLLING_INTERVAL_MS = 30 * 1000;
5
+ export const BEBOP_API_URL = 'https://api.bebop.xyz';
6
+ export const BEBOP_WS_API_URL = 'wss://api.bebop.xyz';
7
+ export const BEBOP_GAS_COST = 120_000;
8
+ export const BEBOP_AUTH_NAME = 'paraswap';
9
+ export const BEBOP_QUOTE_TIMEOUT_MS = 2000;
@@ -0,0 +1,138 @@
1
+ import { ETHER_ADDRESS, Network } from '../../constants';
2
+ import { IDexHelper } from '../../dex-helper';
3
+ import { Fetcher } from '../../lib/fetcher/fetcher';
4
+ import { validateAndCast } from '../../lib/validators';
5
+ import { Logger, Token } from '../../types';
6
+ import {
7
+ BebopPricingResponse,
8
+ BebopRateFetcherConfig,
9
+ BebopTokensResponse,
10
+ } from './types';
11
+ import { pricesResponseValidator, tokensResponseValidator } from './validators';
12
+ import { WebSocketFetcher } from '../../lib/fetcher/wsFetcher';
13
+
14
+ export class RateFetcher {
15
+ private pricesFetcher: WebSocketFetcher<BebopPricingResponse>;
16
+ private pricesCacheKey: string;
17
+ private pricesCacheTTL: number;
18
+
19
+ private tokensFetcher: Fetcher<BebopTokensResponse>;
20
+ private tokensAddrCacheKey: string;
21
+ private tokensCacheKey: string;
22
+ private tokensCacheTTL: number;
23
+
24
+ constructor(
25
+ private dexHelper: IDexHelper,
26
+ private dexKey: string,
27
+ private network: Network,
28
+ private logger: Logger,
29
+ config: BebopRateFetcherConfig,
30
+ ) {
31
+ this.pricesCacheKey = config.rateConfig.pricesCacheKey;
32
+ this.pricesCacheTTL = config.rateConfig.pricesCacheTTLSecs;
33
+ this.pricesFetcher = new WebSocketFetcher<BebopPricingResponse>(
34
+ {
35
+ info: {
36
+ requestOptions: config.rateConfig.pricesReqParams,
37
+ caster: (data: unknown) => {
38
+ return validateAndCast<BebopPricingResponse>(
39
+ data,
40
+ pricesResponseValidator,
41
+ );
42
+ },
43
+ },
44
+ handler: this.handlePricesResponse.bind(this),
45
+ },
46
+ logger,
47
+ );
48
+
49
+ this.tokensAddrCacheKey = config.rateConfig.tokensAddrCacheKey;
50
+ this.tokensCacheKey = config.rateConfig.tokensCacheKey;
51
+ this.tokensCacheTTL = config.rateConfig.tokensCacheTTLSecs;
52
+ this.tokensFetcher = new Fetcher<BebopTokensResponse>(
53
+ dexHelper.httpRequest,
54
+ {
55
+ info: {
56
+ requestOptions: config.rateConfig.tokensReqParams,
57
+ caster: (data: unknown) => {
58
+ return validateAndCast<BebopTokensResponse>(
59
+ data,
60
+ tokensResponseValidator,
61
+ );
62
+ },
63
+ },
64
+ handler: this.handleTokensResponse.bind(this),
65
+ },
66
+ config.rateConfig.tokensIntervalMs,
67
+ logger,
68
+ );
69
+ }
70
+
71
+ start() {
72
+ this.pricesFetcher.startPolling();
73
+ this.tokensFetcher.startPolling();
74
+ }
75
+
76
+ stop() {
77
+ this.pricesFetcher.stopPolling();
78
+ this.tokensFetcher.stopPolling();
79
+ }
80
+
81
+ private handleTokensResponse(resp: BebopTokensResponse): void {
82
+ const tokenMap: { [address: string]: Token } = {};
83
+ const tokenAddrMap: { [symbol: string]: Token } = {};
84
+
85
+ Object.keys(resp.tokens).forEach(tokenSymbol => {
86
+ const token = resp.tokens[tokenSymbol];
87
+ const tokenData = {
88
+ address: token.contractAddress.toLowerCase(),
89
+ symbol: token.ticker,
90
+ decimals: token.decimals,
91
+ };
92
+ tokenAddrMap[token.contractAddress.toLowerCase()] = tokenData;
93
+ tokenMap[token.ticker.toLowerCase()] = tokenData;
94
+ });
95
+
96
+ this.dexHelper.cache.setex(
97
+ this.dexKey,
98
+ this.network,
99
+ this.tokensCacheKey,
100
+ this.tokensCacheTTL,
101
+ JSON.stringify(tokenMap),
102
+ );
103
+
104
+ this.dexHelper.cache.setex(
105
+ this.dexKey,
106
+ this.network,
107
+ this.tokensAddrCacheKey,
108
+ this.tokensCacheTTL,
109
+ JSON.stringify(tokenAddrMap),
110
+ );
111
+ }
112
+
113
+ private handlePricesResponse(resp: BebopPricingResponse): void {
114
+ const wethAddress =
115
+ this.dexHelper.config.data.wrappedNativeTokenAddress.toLowerCase();
116
+ const normalizedPrices: BebopPricingResponse = {};
117
+ for (const [pair, levels] of Object.entries(resp)) {
118
+ normalizedPrices[pair.toLowerCase()] = levels;
119
+ const [base, quote] = pair.split('/');
120
+ // Also enter native token prices. Pricing doesn't come with these
121
+ if (
122
+ base.toLowerCase() === wethAddress ||
123
+ quote.toLowerCase() === wethAddress
124
+ ) {
125
+ const nativePair = pair.replace(base, ETHER_ADDRESS);
126
+ normalizedPrices[nativePair.toLowerCase()] = levels;
127
+ }
128
+ }
129
+
130
+ this.dexHelper.cache.setex(
131
+ this.dexKey,
132
+ this.network,
133
+ this.pricesCacheKey,
134
+ this.pricesCacheTTL,
135
+ JSON.stringify(normalizedPrices),
136
+ );
137
+ }
138
+ }
@@ -0,0 +1,81 @@
1
+ import { SwapSide } from '../../constants';
2
+ import { RequestHeaders } from '../../dex-helper';
3
+
4
+ export type BebopRateFetcherConfig = {
5
+ rateConfig: {
6
+ pricesReqParams: {
7
+ url: string;
8
+ headers?: RequestHeaders;
9
+ params?: any;
10
+ };
11
+ tokensReqParams: {
12
+ url: string;
13
+ headers?: RequestHeaders;
14
+ params?: any;
15
+ };
16
+ tokensIntervalMs: number;
17
+ pricesCacheKey: string;
18
+ tokensAddrCacheKey: string;
19
+ tokensCacheKey: string;
20
+ pricesCacheTTLSecs: number;
21
+ tokensCacheTTLSecs: number;
22
+ };
23
+ };
24
+
25
+ export type TokenDataMap = { [index: string]: BebopToken };
26
+
27
+ export type BebopToken = {
28
+ decimals: number;
29
+ contractAddress: string;
30
+ ticker: string;
31
+ };
32
+
33
+ export type BebopTokensResponse = {
34
+ tokens: { [symbol: string]: BebopToken };
35
+ };
36
+
37
+ export type BebopLevel = [price: number, size: number];
38
+
39
+ export type BebopPair = {
40
+ bids: BebopLevel[];
41
+ asks: BebopLevel[];
42
+ last_update_ts: number;
43
+ };
44
+
45
+ export type BebopPricingResponse = {
46
+ [pair: string]: BebopPair;
47
+ };
48
+
49
+ export interface BebopTx {
50
+ to: string;
51
+ value: string;
52
+ data: string;
53
+ from: string;
54
+ gas: number;
55
+ }
56
+
57
+ export type BebopTokenAmount = {
58
+ amount: string;
59
+ priceUsd: number;
60
+ };
61
+
62
+ // For now nothing but we may have to add something
63
+ export type BebopData = {
64
+ expiry?: number;
65
+ buyTokens?: { [address: string]: BebopTokenAmount };
66
+ sellTokens?: { [address: string]: BebopTokenAmount };
67
+ tx?: BebopTx;
68
+ };
69
+
70
+ export type DexParams = {
71
+ settlementAddress: string;
72
+ chainName: string;
73
+ middleTokens: string[];
74
+ };
75
+
76
+ export type RoutingInstruction = {
77
+ side: SwapSide; // Buy for bids, Sell for asks
78
+ book: BebopPair;
79
+ pair: string;
80
+ targetQuote: boolean;
81
+ };
@@ -0,0 +1,43 @@
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 levelValidator = joi.array().items(joi.number()).length(2);
18
+
19
+ const pairValidator = joi.object({
20
+ bids: joi.array().items(levelValidator).required(),
21
+ asks: joi.array().items(levelValidator).required(),
22
+ last_update_ts: joi.number().min(0).required(),
23
+ });
24
+
25
+ export const pricesResponseValidator = joi
26
+ .object()
27
+ .pattern(joi.string(), pairValidator);
28
+
29
+ const tokenValidator = joi
30
+ .object({
31
+ ticker: joi.string().min(1).required(),
32
+ contractAddress: joi.string().min(1).required(),
33
+ decimals: joi.number().min(0).required(),
34
+ })
35
+ .unknown(true);
36
+
37
+ export const tokensResponseValidator = joi.object({
38
+ tokens: joi.object().pattern(joi.string(), tokenValidator),
39
+ });
40
+
41
+ export const blacklistResponseValidator = joi.object({
42
+ blacklist: joi.array().items(joi.string().min(1)).required(),
43
+ });
@@ -21,6 +21,8 @@ export class Compound
21
21
  static dexKeys = ['compound'];
22
22
  cethInterface: Interface;
23
23
 
24
+ needWrapNative = false;
25
+
24
26
  constructor(dexHelper: IDexHelper) {
25
27
  super(dexHelper, 'compound');
26
28
  this.cethInterface = new Interface(Ceth as JsonFragment[]);
@@ -108,6 +108,8 @@ export class CurveV1
108
108
  exchangeRouterInterface: Interface;
109
109
  minConversionRate = '1';
110
110
 
111
+ needWrapNative = false;
112
+
111
113
  eventPools = new Array<CurvePool | CurveMetapool>();
112
114
  public poolInterface: Interface;
113
115
 
@@ -22,6 +22,8 @@ export class DodoV1
22
22
  static dexKeys = ['dodov1'];
23
23
  dodoV2Proxy: Interface;
24
24
 
25
+ needWrapNative = false;
26
+
25
27
  constructor(dexHelper: IDexHelper) {
26
28
  super(dexHelper, 'dodov1');
27
29
  this.dodoV2Proxy = new Interface(DodoV2ProxyABI as JsonFragment[]);