@paraswap/dex-lib 3.8.12 → 3.8.13-arusd-fxusd.2

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 (247) hide show
  1. package/.vscode/launch.json +6 -43
  2. package/.vscode/settings.json +2 -1
  3. package/build/abi/Uncompressor.json +250 -0
  4. package/build/abi/concentrator/arUSD.json +568 -0
  5. package/build/abi/concentrator/arUSD5115.json +1746 -0
  6. package/build/abi/fx-protocol/FxMarket.json +1284 -0
  7. package/build/abi/{wombat/pool.json → fx-protocol/FxUSD.json} +541 -603
  8. package/build/abi/fx-protocol/weETHOralce.json +676 -0
  9. package/build/abi/integral/factory.json +333 -0
  10. package/build/abi/integral/oracle.json +501 -0
  11. package/build/abi/integral/pool.json +1041 -0
  12. package/build/abi/integral/relayer.json +1536 -0
  13. package/build/abi/oswap/oswap.abi.json +452 -0
  14. package/build/config.js +6 -6
  15. package/build/dex/aave-v1/aave-v1.d.ts +1 -2
  16. package/build/dex/aave-v1/aave-v1.js +0 -23
  17. package/build/dex/aave-v1/aave-v1.js.map +1 -1
  18. package/build/dex/compound.js +1 -1
  19. package/build/dex/compound.js.map +1 -1
  20. package/build/dex/concentrator-arusd/concentrator-arusd-event.d.ts +16 -0
  21. package/build/dex/concentrator-arusd/concentrator-arusd-event.js +53 -0
  22. package/build/dex/concentrator-arusd/concentrator-arusd-event.js.map +1 -0
  23. package/build/dex/concentrator-arusd/concentrator-arusd.d.ts +41 -0
  24. package/build/dex/concentrator-arusd/concentrator-arusd.js +180 -0
  25. package/build/dex/concentrator-arusd/concentrator-arusd.js.map +1 -0
  26. package/build/dex/concentrator-arusd/config.d.ts +4 -0
  27. package/build/dex/concentrator-arusd/config.js +18 -0
  28. package/build/dex/concentrator-arusd/config.js.map +1 -0
  29. package/build/dex/concentrator-arusd/types.d.ts +14 -0
  30. package/build/dex/concentrator-arusd/types.js +3 -0
  31. package/build/dex/concentrator-arusd/types.js.map +1 -0
  32. package/build/dex/concentrator-arusd/utils.d.ts +4 -0
  33. package/build/dex/concentrator-arusd/utils.js +27 -0
  34. package/build/dex/concentrator-arusd/utils.js.map +1 -0
  35. package/build/dex/etherfi/etherfi.d.ts +26 -0
  36. package/build/dex/etherfi/etherfi.js +96 -0
  37. package/build/dex/etherfi/etherfi.js.map +1 -0
  38. package/build/dex/fx-protocol-rusd/config.d.ts +3 -0
  39. package/build/dex/fx-protocol-rusd/config.js +15 -0
  40. package/build/dex/fx-protocol-rusd/config.js.map +1 -0
  41. package/build/dex/fx-protocol-rusd/fx-protocol-rusd-event.d.ts +18 -0
  42. package/build/dex/fx-protocol-rusd/fx-protocol-rusd-event.js +63 -0
  43. package/build/dex/fx-protocol-rusd/fx-protocol-rusd-event.js.map +1 -0
  44. package/build/dex/fx-protocol-rusd/fx-protocol-rusd.d.ts +39 -0
  45. package/build/dex/fx-protocol-rusd/fx-protocol-rusd.js +213 -0
  46. package/build/dex/fx-protocol-rusd/fx-protocol-rusd.js.map +1 -0
  47. package/build/dex/fx-protocol-rusd/types.d.ts +13 -0
  48. package/build/dex/fx-protocol-rusd/types.js +3 -0
  49. package/build/dex/fx-protocol-rusd/types.js.map +1 -0
  50. package/build/dex/fx-protocol-rusd/utils.d.ts +4 -0
  51. package/build/dex/fx-protocol-rusd/utils.js +26 -0
  52. package/build/dex/fx-protocol-rusd/utils.js.map +1 -0
  53. package/build/dex/index.js +4 -0
  54. package/build/dex/index.js.map +1 -1
  55. package/build/dex/integral/config.d.ts +4 -0
  56. package/build/dex/integral/config.js +20 -0
  57. package/build/dex/integral/config.js.map +1 -0
  58. package/build/dex/integral/context.d.ts +40 -0
  59. package/build/dex/integral/context.js +158 -0
  60. package/build/dex/integral/context.js.map +1 -0
  61. package/build/dex/integral/helpers.d.ts +17 -0
  62. package/build/dex/integral/helpers.js +157 -0
  63. package/build/dex/integral/helpers.js.map +1 -0
  64. package/build/dex/integral/integral-factory.d.ts +24 -0
  65. package/build/dex/integral/integral-factory.js +95 -0
  66. package/build/dex/integral/integral-factory.js.map +1 -0
  67. package/build/dex/integral/integral-pool.d.ts +50 -0
  68. package/build/dex/integral/integral-pool.js +149 -0
  69. package/build/dex/integral/integral-pool.js.map +1 -0
  70. package/build/dex/integral/integral-pricing.d.ts +18 -0
  71. package/build/dex/integral/integral-pricing.js +114 -0
  72. package/build/dex/integral/integral-pricing.js.map +1 -0
  73. package/build/dex/integral/integral-relayer.d.ts +42 -0
  74. package/build/dex/integral/integral-relayer.js +192 -0
  75. package/build/dex/integral/integral-relayer.js.map +1 -0
  76. package/build/dex/integral/integral-token.d.ts +27 -0
  77. package/build/dex/integral/integral-token.js +59 -0
  78. package/build/dex/integral/integral-token.js.map +1 -0
  79. package/build/dex/integral/integral.d.ts +41 -0
  80. package/build/dex/integral/integral.js +377 -0
  81. package/build/dex/integral/integral.js.map +1 -0
  82. package/build/dex/integral/types.d.ts +84 -0
  83. package/build/dex/integral/types.js +9 -0
  84. package/build/dex/integral/types.js.map +1 -0
  85. package/build/dex/integral/utils-e2e.d.ts +9 -0
  86. package/build/dex/integral/utils-e2e.js +131 -0
  87. package/build/dex/integral/utils-e2e.js.map +1 -0
  88. package/build/dex/integral/utils.d.ts +17 -0
  89. package/build/dex/integral/utils.js +94 -0
  90. package/build/dex/integral/utils.js.map +1 -0
  91. package/build/dex/oswap/config.d.ts +5 -0
  92. package/build/dex/oswap/config.js +31 -0
  93. package/build/dex/oswap/config.js.map +1 -0
  94. package/build/dex/oswap/oswap-pool.d.ts +51 -0
  95. package/build/dex/oswap/oswap-pool.js +150 -0
  96. package/build/dex/oswap/oswap-pool.js.map +1 -0
  97. package/build/dex/oswap/oswap.d.ts +46 -0
  98. package/build/dex/oswap/oswap.js +266 -0
  99. package/build/dex/oswap/oswap.js.map +1 -0
  100. package/build/dex/oswap/types.d.ts +20 -0
  101. package/build/dex/oswap/types.js +3 -0
  102. package/build/dex/oswap/types.js.map +1 -0
  103. package/build/dex/platypus/platypus.d.ts +1 -2
  104. package/build/dex/platypus/platypus.js +0 -45
  105. package/build/dex/platypus/platypus.js.map +1 -1
  106. package/build/dex/sdai/config.d.ts +11 -0
  107. package/build/dex/sdai/config.js +21 -0
  108. package/build/dex/sdai/config.js.map +1 -0
  109. package/build/dex/sdai/constants.d.ts +2 -0
  110. package/build/dex/sdai/constants.js +6 -0
  111. package/build/dex/sdai/constants.js.map +1 -0
  112. package/build/dex/sdai/scripts/validate-state.js +102 -0
  113. package/build/dex/sdai/scripts/validate-state.js.map +1 -0
  114. package/build/dex/sdai/sdai-pool.d.ts +16 -0
  115. package/build/dex/sdai/sdai-pool.js +85 -0
  116. package/build/dex/sdai/sdai-pool.js.map +1 -0
  117. package/build/dex/sdai/sdai.d.ts +51 -0
  118. package/build/dex/sdai/sdai.js +172 -0
  119. package/build/dex/sdai/sdai.js.map +1 -0
  120. package/build/dex/sdai/types.d.ts +21 -0
  121. package/build/dex/sdai/types.js +11 -0
  122. package/build/dex/sdai/types.js.map +1 -0
  123. package/build/dex/sdai/utils.d.ts +4 -0
  124. package/build/dex/sdai/utils.js +39 -0
  125. package/build/dex/sdai/utils.js.map +1 -0
  126. package/build/dex/solidly-v3/config.js +39 -0
  127. package/build/dex/solidly-v3/config.js.map +1 -1
  128. package/build/dex/stable-pool.js +8 -1
  129. package/build/dex/stable-pool.js.map +1 -1
  130. package/build/dex/swaap-v1/swaap-v1.d.ts +1 -2
  131. package/build/dex/swaap-v1/swaap-v1.js +0 -14
  132. package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
  133. package/build/executor/compressor/Compressor.d.ts +23 -0
  134. package/build/executor/compressor/Compressor.js +144 -0
  135. package/build/executor/compressor/Compressor.js.map +1 -0
  136. package/build/executor/compressor/compress.d.ts +17 -0
  137. package/build/executor/compressor/compress.js +187 -0
  138. package/build/executor/compressor/compress.js.map +1 -0
  139. package/build/executor/compressor/compress_functions/addressSubstitution.d.ts +6 -0
  140. package/build/executor/compressor/compress_functions/addressSubstitution.js +29 -0
  141. package/build/executor/compressor/compress_functions/addressSubstitution.js.map +1 -0
  142. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.d.ts +10 -0
  143. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js +40 -0
  144. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js.map +1 -0
  145. package/build/executor/compressor/compress_functions/byteSubstitution.d.ts +11 -0
  146. package/build/executor/compressor/compress_functions/byteSubstitution.js +64 -0
  147. package/build/executor/compressor/compress_functions/byteSubstitution.js.map +1 -0
  148. package/build/executor/compressor/compress_functions/ffSubstitution.d.ts +7 -0
  149. package/build/executor/compressor/compress_functions/ffSubstitution.js +54 -0
  150. package/build/executor/compressor/compress_functions/ffSubstitution.js.map +1 -0
  151. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.d.ts +8 -0
  152. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js +67 -0
  153. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js.map +1 -0
  154. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.d.ts +8 -0
  155. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js +61 -0
  156. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js.map +1 -0
  157. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.d.ts +6 -0
  158. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js +37 -0
  159. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js.map +1 -0
  160. package/build/executor/compressor/compress_functions/searchUnusedBytes.d.ts +9 -0
  161. package/build/executor/compressor/compress_functions/searchUnusedBytes.js +33 -0
  162. package/build/executor/compressor/compress_functions/searchUnusedBytes.js.map +1 -0
  163. package/build/executor/compressor/fetchSaved.js +17 -0
  164. package/build/executor/compressor/fetchSaved.js.map +1 -0
  165. package/build/executor/compressor/utils/computeCostL2.d.ts +2 -0
  166. package/build/executor/compressor/utils/computeCostL2.js +14 -0
  167. package/build/executor/compressor/utils/computeCostL2.js.map +1 -0
  168. package/build/executor/compressor/utils/findLongestDuplicatedString.d.ts +2 -0
  169. package/build/executor/compressor/utils/findLongestDuplicatedString.js +30 -0
  170. package/build/executor/compressor/utils/findLongestDuplicatedString.js.map +1 -0
  171. package/build/executor/compressor/utils/getAllIndexes.d.ts +2 -0
  172. package/build/executor/compressor/utils/getAllIndexes.js +12 -0
  173. package/build/executor/compressor/utils/getAllIndexes.js.map +1 -0
  174. package/build/executor/compressor/utils/getByteForAddress.d.ts +2 -0
  175. package/build/executor/compressor/utils/getByteForAddress.js +14 -0
  176. package/build/executor/compressor/utils/getByteForAddress.js.map +1 -0
  177. package/build/executor/compressor/utils/intTo2Bytes.d.ts +2 -0
  178. package/build/executor/compressor/utils/intTo2Bytes.js +14 -0
  179. package/build/executor/compressor/utils/intTo2Bytes.js.map +1 -0
  180. package/build/executor/compressor/utils/intTo3Bytes.d.ts +2 -0
  181. package/build/executor/compressor/utils/intTo3Bytes.js +18 -0
  182. package/build/executor/compressor/utils/intTo3Bytes.js.map +1 -0
  183. package/build/executor/compressor/utils/intToByte.d.ts +2 -0
  184. package/build/executor/compressor/utils/intToByte.js +10 -0
  185. package/build/executor/compressor/utils/intToByte.js.map +1 -0
  186. package/build/implementations/local-paraswap-sdk.d.ts +2 -0
  187. package/build/implementations/local-paraswap-sdk.js +7 -0
  188. package/build/implementations/local-paraswap-sdk.js.map +1 -1
  189. package/package.json +1 -1
  190. package/src/abi/concentrator/arUSD.json +568 -0
  191. package/src/abi/concentrator/arUSD5115.json +1746 -0
  192. package/src/abi/fx-protocol/FxMarket.json +1284 -0
  193. package/src/abi/fx-protocol/FxUSD.json +1227 -0
  194. package/src/abi/fx-protocol/weETHOralce.json +676 -0
  195. package/src/config.ts +6 -6
  196. package/src/dex/concentrator-arusd/concentrator-arusd-e2e.test.ts +92 -0
  197. package/src/dex/concentrator-arusd/concentrator-arusd-event.ts +70 -0
  198. package/src/dex/concentrator-arusd/concentrator-arusd-integration.test.ts +104 -0
  199. package/src/dex/concentrator-arusd/concentrator-arusd.ts +255 -0
  200. package/src/dex/concentrator-arusd/concetrator-arusd-events.test.ts +97 -0
  201. package/src/dex/concentrator-arusd/config.ts +18 -0
  202. package/src/dex/concentrator-arusd/types.ts +16 -0
  203. package/src/dex/concentrator-arusd/utils.ts +36 -0
  204. package/src/dex/fx-protocol-rusd/config.ts +14 -0
  205. package/src/dex/fx-protocol-rusd/fx-protocol-e2e.test.ts +96 -0
  206. package/src/dex/fx-protocol-rusd/fx-protocol-events.test.ts +101 -0
  207. package/src/dex/fx-protocol-rusd/fx-protocol-integration.test.ts +104 -0
  208. package/src/dex/fx-protocol-rusd/fx-protocol-rusd-event.ts +80 -0
  209. package/src/dex/fx-protocol-rusd/fx-protocol-rusd.ts +303 -0
  210. package/src/dex/fx-protocol-rusd/types.ts +16 -0
  211. package/src/dex/fx-protocol-rusd/utils.ts +46 -0
  212. package/src/dex/index.ts +4 -0
  213. package/src/dex/solidly-v3/config.ts +42 -0
  214. package/src/dex/solidly-v3/solidly-v3-e2e.test.ts +114 -3
  215. package/src/dex/wsteth/wsteth-integration.test.ts +0 -1
  216. package/src/implementations/local-paraswap-sdk.ts +8 -0
  217. package/tests/constants-e2e.ts +11 -1
  218. package/.vscode/tasks.json +0 -15
  219. package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +0 -52
  220. package/build/dex/aave-v2/tokens-avalanche.json +0 -44
  221. package/build/dex/aave-v2/tokens-mainnet.json +0 -188
  222. package/build/dex/aave-v2/tokens-polygon.json +0 -44
  223. package/build/dex/maker-psm/scripts/gem.abi.json +0 -136
  224. package/build/dex/maker-psm/scripts/validate-state.js +0 -185
  225. package/build/dex/maker-psm/scripts/validate-state.js.map +0 -1
  226. package/build/dex/maker-psm/scripts/vat.abi.json +0 -243
  227. package/build/dex/solidly-v3/scripts/check-event-pool-event.js +0 -53
  228. package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +0 -1
  229. package/build/dex/trader-joe-v2.1/base.d.ts +0 -18
  230. package/build/dex/trader-joe-v2.1/base.js +0 -99
  231. package/build/dex/trader-joe-v2.1/base.js.map +0 -1
  232. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +0 -7
  233. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +0 -20
  234. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +0 -1
  235. package/build/dex/trader-joe-v2.1/trader-joe-v2.2.d.ts +0 -7
  236. package/build/dex/trader-joe-v2.1/trader-joe-v2.2.js +0 -20
  237. package/build/dex/trader-joe-v2.1/trader-joe-v2.2.js.map +0 -1
  238. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +0 -17
  239. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +0 -64
  240. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +0 -1
  241. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +0 -17
  242. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +0 -79
  243. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +0 -1
  244. package/config.ts +0 -1946
  245. package/src/dex/dexs.txt +0 -58
  246. /package/build/dex/{solidly-v3/scripts/check-event-pool-event.d.ts → sdai/scripts/validate-state.d.ts} +0 -0
  247. /package/build/{dex/maker-psm/scripts/validate-state.d.ts → executor/compressor/fetchSaved.d.ts} +0 -0
@@ -0,0 +1,41 @@
1
+ import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, PoolLiquidity, Logger, NumberAsString, DexExchangeParam } from '../../types';
2
+ import { SwapSide, Network } from '../../constants';
3
+ import { Context, IDex } from '../../dex/idex';
4
+ import { IDexHelper } from '../../dex-helper/idex-helper';
5
+ import { ConcentratorArusdData, DexParams } from './types';
6
+ import { SimpleExchange } from '../simple-exchange';
7
+ import { Interface } from '@ethersproject/abi';
8
+ import { ConcentratorArusdEvent } from './concentrator-arusd-event';
9
+ export declare class ConcentratorArusd extends SimpleExchange implements IDex<ConcentratorArusdData> {
10
+ readonly network: Network;
11
+ readonly dexKey: string;
12
+ readonly dexHelper: IDexHelper;
13
+ protected adapters: import("../../types").AdapterMappings;
14
+ static readonly arUSDIface: Interface;
15
+ protected config: DexParams;
16
+ readonly hasConstantPriceLargeAmounts = true;
17
+ readonly needWrapNative = true;
18
+ readonly isFeeOnTransferSupported = false;
19
+ static dexKeysWithNetwork: {
20
+ key: string;
21
+ networks: Network[];
22
+ }[];
23
+ arUSD5115Iface: Interface;
24
+ concentratorArusdEvent: ConcentratorArusdEvent;
25
+ logger: Logger;
26
+ constructor(network: Network, dexKey: string, dexHelper: IDexHelper, adapters?: import("../../types").AdapterMappings);
27
+ initializePricing(blockNumber: number): Promise<void>;
28
+ is_arUSD(token: string): boolean;
29
+ is_rUSD(token: string): boolean;
30
+ is_arUSD_swap_token(srcToken: string, destToken: string): boolean;
31
+ getAdapters(side: SwapSide): {
32
+ name: string;
33
+ index: number;
34
+ }[] | null;
35
+ 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<ConcentratorArusdData>>;
37
+ getCalldataGasCost(poolPrices: PoolPrices<ConcentratorArusdData>): number | number[];
38
+ getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: ConcentratorArusdData, side: SwapSide): AdapterExchangeParam;
39
+ getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: ConcentratorArusdData, side: SwapSide, context: Context, executorAddress: Address): Promise<DexExchangeParam>;
40
+ getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
41
+ }
@@ -0,0 +1,180 @@
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.ConcentratorArusd = void 0;
30
+ const constants_1 = require("../../constants");
31
+ const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
32
+ const utils_1 = require("../../utils");
33
+ const simple_exchange_1 = require("../simple-exchange");
34
+ const config_1 = require("./config");
35
+ const abi_1 = require("@ethersproject/abi");
36
+ const arUSD_json_1 = __importDefault(require("../../abi/concentrator/arUSD.json"));
37
+ const arUSD5115_json_1 = __importDefault(require("../../abi/concentrator/arUSD5115.json"));
38
+ const utils_2 = require("../../executor/utils");
39
+ const bigint_constants_1 = require("../../bigint-constants");
40
+ const concentrator_arusd_event_1 = require("./concentrator-arusd-event");
41
+ const utils_3 = require("./utils");
42
+ class ConcentratorArusd extends simple_exchange_1.SimpleExchange {
43
+ constructor(network, dexKey, dexHelper, adapters = config_1.Adapters[network] || {}) {
44
+ super(dexHelper, dexKey);
45
+ this.network = network;
46
+ this.dexKey = dexKey;
47
+ this.dexHelper = dexHelper;
48
+ this.adapters = adapters;
49
+ this.hasConstantPriceLargeAmounts = true;
50
+ this.needWrapNative = true;
51
+ this.isFeeOnTransferSupported = false;
52
+ const config = config_1.ConcentratorArusdConfig[dexKey][network];
53
+ this.config = {
54
+ rUSDAddress: config.rUSDAddress.toLowerCase(),
55
+ arUSDAddress: config.arUSDAddress.toLowerCase(),
56
+ arUSD5115Address: config.arUSD5115Address.toLowerCase(),
57
+ };
58
+ this.arUSD5115Iface = new abi_1.Interface(arUSD5115_json_1.default);
59
+ this.logger = dexHelper.getLogger(dexKey);
60
+ this.concentratorArusdEvent = new concentrator_arusd_event_1.ConcentratorArusdEvent(this.dexKey, dexHelper, this.config.arUSD5115Address, this.arUSD5115Iface, this.logger);
61
+ }
62
+ async initializePricing(blockNumber) {
63
+ const poolState = await (0, utils_3.getOnChainState)(this.dexHelper.multiContract, this.config.arUSD5115Address, this.arUSD5115Iface, blockNumber);
64
+ await this.concentratorArusdEvent.initialize(blockNumber, {
65
+ state: poolState,
66
+ });
67
+ }
68
+ is_arUSD(token) {
69
+ return token.toLowerCase() === this.config.arUSDAddress;
70
+ }
71
+ is_rUSD(token) {
72
+ return token.toLowerCase() === this.config.rUSDAddress;
73
+ }
74
+ is_arUSD_swap_token(srcToken, destToken) {
75
+ if (this.is_rUSD(srcToken) && this.is_arUSD(destToken)) {
76
+ return true;
77
+ }
78
+ if (this.is_arUSD(srcToken) && this.is_rUSD(destToken)) {
79
+ return true;
80
+ }
81
+ return false;
82
+ }
83
+ getAdapters(side) {
84
+ return null;
85
+ }
86
+ async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
87
+ if (!this.is_arUSD_swap_token(srcToken.address, destToken.address)) {
88
+ return [];
89
+ }
90
+ return [`${this.dexKey}_${this.config.arUSDAddress}`];
91
+ }
92
+ async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
93
+ if (side == constants_1.SwapSide.BUY) {
94
+ // note: BUY is not supported
95
+ return null;
96
+ }
97
+ const isArUSDSwapToken = this.is_arUSD_swap_token(srcToken.address, destToken.address);
98
+ if (!isArUSDSwapToken) {
99
+ return null;
100
+ }
101
+ const is_deposit = !!this.is_rUSD(srcToken.address);
102
+ const pool = this.concentratorArusdEvent;
103
+ const unitIn = bigint_constants_1.BI_POWS[18];
104
+ const unitOut = pool.getPrice(blockNumber, unitIn, is_deposit);
105
+ const amountsOut = amounts.map(amountIn => {
106
+ const _newPrice = pool.getPrice(blockNumber, amountIn, is_deposit);
107
+ return _newPrice;
108
+ });
109
+ return [
110
+ {
111
+ unit: unitOut,
112
+ prices: amountsOut,
113
+ data: {},
114
+ poolAddresses: [this.config.arUSDAddress],
115
+ exchange: this.dexKey,
116
+ gasCost: 1000000,
117
+ },
118
+ ];
119
+ }
120
+ // Returns estimated gas cost of calldata for this DEX in multiSwap
121
+ getCalldataGasCost(poolPrices) {
122
+ return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
123
+ }
124
+ getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
125
+ const payload = '0x';
126
+ return {
127
+ targetExchange: this.config.rUSDAddress,
128
+ payload,
129
+ networkFee: '0',
130
+ };
131
+ }
132
+ async getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side, context, executorAddress) {
133
+ const is_rUSD_src = this.is_rUSD(srcToken);
134
+ const is_arUSD_src = this.is_arUSD(srcToken);
135
+ const is_rUSD_dest = this.is_rUSD(destToken);
136
+ const is_arUSD_dest = this.is_arUSD(destToken);
137
+ if (is_rUSD_src && is_arUSD_dest) {
138
+ const exchangeData = ConcentratorArusd.arUSDIface.encodeFunctionData('deposit', [srcAmount, recipient]);
139
+ return {
140
+ needWrapNative: false,
141
+ dexFuncHasRecipient: true,
142
+ exchangeData,
143
+ targetExchange: this.config.arUSDAddress,
144
+ returnAmountPos: (0, utils_2.extractReturnAmountPosition)(ConcentratorArusd.arUSDIface, 'deposit', 'shares'),
145
+ };
146
+ }
147
+ if (is_arUSD_src && is_rUSD_dest) {
148
+ const exchangeData = ConcentratorArusd.arUSDIface.encodeFunctionData('redeem', [srcAmount, recipient, executorAddress]);
149
+ return {
150
+ needWrapNative: false,
151
+ dexFuncHasRecipient: true,
152
+ exchangeData,
153
+ targetExchange: this.config.arUSDAddress,
154
+ returnAmountPos: (0, utils_2.extractReturnAmountPosition)(ConcentratorArusd.arUSDIface, 'redeem', 'assets'),
155
+ };
156
+ }
157
+ throw new Error('LOGIC ERROR');
158
+ }
159
+ // Returns list of top pools based on liquidity. Max
160
+ // limit number pools should be returned.
161
+ async getTopPoolsForToken(tokenAddress, limit) {
162
+ return [
163
+ {
164
+ exchange: this.dexKey,
165
+ address: this.config.arUSDAddress,
166
+ connectorTokens: [
167
+ {
168
+ decimals: 18,
169
+ address: this.config.arUSDAddress,
170
+ },
171
+ ],
172
+ liquidityUSD: 1000000000, // Just returning a big number so this DEX will be preferred
173
+ },
174
+ ];
175
+ }
176
+ }
177
+ exports.ConcentratorArusd = ConcentratorArusd;
178
+ ConcentratorArusd.arUSDIface = new abi_1.Interface(arUSD_json_1.default);
179
+ ConcentratorArusd.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.ConcentratorArusdConfig);
180
+ //# sourceMappingURL=concentrator-arusd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concentrator-arusd.js","sourceRoot":"","sources":["../../../src/dex/concentrator-arusd/concentrator-arusd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,+CAAoD;AACpD,2EAA6D;AAC7D,uCAAoD;AAIpD,wDAAoD;AACpD,qCAA6D;AAC7D,4CAA+C;AAC/C,mFAA0D;AAC1D,2FAAkE;AAClE,gDAAmE;AACnE,6DAAiD;AACjD,yEAAoE;AACpE,mCAA0C;AAE1C,MAAa,iBACX,SAAQ,gCAAc;IAmBtB,YACW,OAAgB,EAChB,MAAc,EACd,SAAqB,EACpB,WAAW,iBAAQ,CAAC,OAAO,CAAC,IAAI,EAAE;QAE5C,K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ACE,QAAQ,EAAE,IAAI,CAAC,MAAM;gBACrB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;gBACjC,eAAe,EAAE;oBACf;wBACE,QAAQ,EAAE,EAAE;wBACZ,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;qBAClC;iBACF;gBACD,YAAY,EAAE,UAAU,EAAE,4DAA4D;aACvF;SACF,CAAC;IACJ,CAAC;;AAlOH,8CAmOC;AA/NiB,4BAAU,GAAG,IAAI,eAAS,CAAC,oBAAS,CAAC,CAAC;AASxC,oCAAkB,GAC9B,IAAA,6BAAqB,EAAC,gCAAuB,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { DexParams } from './types';
2
+ import { DexConfigMap, AdapterMappings } from '../../types';
3
+ export declare const ConcentratorArusdConfig: DexConfigMap<DexParams>;
4
+ export declare const Adapters: Record<number, AdapterMappings>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Adapters = exports.ConcentratorArusdConfig = void 0;
4
+ const constants_1 = require("../../constants");
5
+ exports.ConcentratorArusdConfig = {
6
+ ConcentratorArusd: {
7
+ [constants_1.Network.MAINNET]: {
8
+ rUSDAddress: '0x65D72AA8DA931F047169112fcf34f52DbaAE7D18',
9
+ arUSDAddress: '0x07D1718fF05a8C53C8F05aDAEd57C0d672945f9a',
10
+ arUSD5115Address: '0x549716F858aefF9CB845d4C78c67A7599B0Df240',
11
+ },
12
+ },
13
+ };
14
+ exports.Adapters = {
15
+ // This is an example to copy
16
+ [constants_1.Network.MAINNET]: { [constants_1.SwapSide.SELL]: [{ name: 'Adapter02', index: 0 }] },
17
+ };
18
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/concentrator-arusd/config.ts"],"names":[],"mappings":";;;AAEA,+CAAoD;AAEvC,QAAA,uBAAuB,GAA4B;IAC9D,iBAAiB,EAAE;QACjB,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,WAAW,EAAE,4CAA4C;YACzD,YAAY,EAAE,4CAA4C;YAC1D,gBAAgB,EAAE,4CAA4C;SAC/D;KACF;CACF,CAAC;AAEW,QAAA,QAAQ,GAAoC;IACvD,6BAA6B;IAC7B,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,oBAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE;CAC1E,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { Address } from '../../types';
2
+ export declare type ConcentratorArusdState = {
3
+ totalSupply: bigint;
4
+ totalAssets: bigint;
5
+ };
6
+ export declare type ConcentratorArusdNavState = {
7
+ nav: bigint;
8
+ };
9
+ export declare type ConcentratorArusdData = {};
10
+ export declare type DexParams = {
11
+ arUSDAddress: Address;
12
+ rUSDAddress: Address;
13
+ arUSD5115Address: Address;
14
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/concentrator-arusd/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { Contract } from 'web3-eth-contract';
2
+ import { ConcentratorArusdState } from './types';
3
+ import { Interface } from '@ethersproject/abi';
4
+ export declare function getOnChainState(multiContract: Contract, poolAddress: string, poolInterface: Interface, blockNumber: number | 'latest'): Promise<ConcentratorArusdState>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOnChainState = void 0;
4
+ const abi_1 = require("@ethersproject/abi");
5
+ const coder = new abi_1.AbiCoder();
6
+ async function getOnChainState(multiContract, poolAddress, poolInterface, blockNumber) {
7
+ const data = await multiContract.methods
8
+ .aggregate([
9
+ {
10
+ target: poolAddress,
11
+ callData: poolInterface.encodeFunctionData('totalSupply', []),
12
+ },
13
+ {
14
+ target: poolAddress,
15
+ callData: poolInterface.encodeFunctionData('getTotalAssets', []),
16
+ },
17
+ ])
18
+ .call({}, blockNumber);
19
+ const totalSupply = BigInt(poolInterface.decodeFunctionResult('totalSupply', data.returnData[0])[0]);
20
+ const totalAssets = BigInt(poolInterface.decodeFunctionResult('getTotalAssets', data.returnData[1])[0]);
21
+ return {
22
+ totalSupply,
23
+ totalAssets,
24
+ };
25
+ }
26
+ exports.getOnChainState = getOnChainState;
27
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/dex/concentrator-arusd/utils.ts"],"names":[],"mappings":";;;AAEA,4CAAyD;AAEzD,MAAM,KAAK,GAAG,IAAI,cAAQ,EAAE,CAAC;AAEtB,KAAK,UAAU,eAAe,CACnC,aAAuB,EACvB,WAAmB,EACnB,aAAwB,EACxB,WAA8B;IAE9B,MAAM,IAAI,GAA0B,MAAM,aAAa,CAAC,OAAO;SAC5D,SAAS,CAAC;QACT;YACE,MAAM,EAAE,WAAW;YACnB,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,aAAa,EAAE,EAAE,CAAC;SAC9D;QACD;YACE,MAAM,EAAE,WAAW;YACnB,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,gBAAgB,EAAE,EAAE,CAAC;SACjE;KACF,CAAC;SACD,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;IAEzB,MAAM,WAAW,GAAG,MAAM,CACxB,aAAa,CAAC,oBAAoB,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACzE,CAAC;IACF,MAAM,WAAW,GAAG,MAAM,CACxB,aAAa,CAAC,oBAAoB,CAAC,gBAAgB,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC5E,CAAC;IACF,OAAO;QACL,WAAW;QACX,WAAW;KACZ,CAAC;AACJ,CAAC;AA7BD,0CA6BC"}
@@ -0,0 +1,26 @@
1
+ import { Interface } from '@ethersproject/abi';
2
+ import { SwapSide } from '../../constants';
3
+ import { AdapterExchangeParam, SimpleExchangeParam } from '../../types';
4
+ import { IDexTxBuilder } from '../idex';
5
+ import { SimpleExchange } from '../simple-exchange';
6
+ import { IDexHelper } from '../../dex-helper';
7
+ declare type EtherFiData = void;
8
+ declare type eETHPoolDepositParam = [];
9
+ declare type weETHWrap = [_eETHAmount: string];
10
+ declare type weETHUnwrap = [_weETHAmount: string];
11
+ declare type EtherFiParam = eETHPoolDepositParam | weETHWrap | weETHUnwrap;
12
+ export declare class EtherFi extends SimpleExchange implements IDexTxBuilder<EtherFiData, EtherFiParam> {
13
+ static dexKeys: string[];
14
+ eETHPoolInterface: Interface;
15
+ weETHInterface: Interface;
16
+ needWrapNative: boolean;
17
+ eETH: string;
18
+ eETHPool: string;
19
+ weETH: string;
20
+ constructor(dexHelper: IDexHelper);
21
+ is_eETH: (token: string) => boolean;
22
+ is_weETH: (token: string) => boolean;
23
+ getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: EtherFiData, side: SwapSide): Promise<SimpleExchangeParam>;
24
+ getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: EtherFiData, side: SwapSide): AdapterExchangeParam;
25
+ }
26
+ export {};
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.EtherFi = void 0;
7
+ const abi_1 = require("@ethersproject/abi");
8
+ const constants_1 = require("../../constants");
9
+ const simple_exchange_1 = require("../simple-exchange");
10
+ const eETHPool_json_1 = __importDefault(require("../../abi/etherfi/eETHPool.json"));
11
+ const weETH_json_1 = __importDefault(require("../../abi/etherfi/weETH.json"));
12
+ const utils_1 = require("../../utils");
13
+ const ts_essentials_1 = require("ts-essentials");
14
+ const types_1 = require("../weth/types");
15
+ var EtherFiFunctions;
16
+ (function (EtherFiFunctions) {
17
+ EtherFiFunctions["deposit"] = "deposit";
18
+ EtherFiFunctions["wrap"] = "wrap";
19
+ EtherFiFunctions["unwrap"] = "unwrap";
20
+ })(EtherFiFunctions || (EtherFiFunctions = {}));
21
+ const EtherFiConfig = {
22
+ 1: {
23
+ eETH: '0x35fa164735182de50811e8e2e824cfb9b6118ac2',
24
+ eETHPool: '0x308861a430be4cce5502d0a12724771fc6daf216',
25
+ weETH: '0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee',
26
+ },
27
+ };
28
+ class EtherFi extends simple_exchange_1.SimpleExchange {
29
+ constructor(dexHelper) {
30
+ super(dexHelper, 'etherfi');
31
+ this.needWrapNative = false;
32
+ this.is_eETH = (token) => token.toLowerCase() === this.eETH;
33
+ this.is_weETH = (token) => token.toLowerCase() === this.weETH;
34
+ this.eETHPoolInterface = new abi_1.Interface(eETHPool_json_1.default);
35
+ this.weETHInterface = new abi_1.Interface(weETH_json_1.default);
36
+ this.eETH = EtherFiConfig[this.network].eETH.toLowerCase();
37
+ this.eETHPool = EtherFiConfig[this.network].eETHPool.toLowerCase();
38
+ this.weETH = EtherFiConfig[this.network].weETH.toLowerCase();
39
+ }
40
+ async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
41
+ const [Interface, swapCallee, swapFunction, swapFunctionParams] = (() => {
42
+ if (this.is_weETH(destToken)) {
43
+ (0, ts_essentials_1.assert)(this.is_eETH(srcToken), 'srcToken should be eETH');
44
+ return [
45
+ this.weETHInterface,
46
+ this.weETH,
47
+ EtherFiFunctions.wrap,
48
+ [srcAmount],
49
+ ];
50
+ }
51
+ if (this.is_weETH(srcToken)) {
52
+ (0, ts_essentials_1.assert)(this.is_eETH(destToken), 'destToken should be eETH');
53
+ return [
54
+ this.weETHInterface,
55
+ this.weETH,
56
+ EtherFiFunctions.unwrap,
57
+ [srcAmount],
58
+ ];
59
+ }
60
+ if (this.is_eETH(destToken)) {
61
+ (0, ts_essentials_1.assert)(this.isWETH(srcToken) || (0, utils_1.isETHAddress)(srcToken), 'srcToken should be (w)eth');
62
+ return [
63
+ this.eETHPoolInterface,
64
+ this.eETHPool,
65
+ EtherFiFunctions.deposit,
66
+ [],
67
+ ];
68
+ }
69
+ throw new Error('LOGIC ERROR');
70
+ })();
71
+ const swapData = Interface.encodeFunctionData(swapFunction, swapFunctionParams);
72
+ // if src token is WETH, we need to withdraw from weth and pass eth value on call. For other cases, we need to approve and perform call
73
+ const isSrcTokenWeth = this.isWETH(srcToken);
74
+ return this.buildSimpleParamWithoutWETHConversion(isSrcTokenWeth ? constants_1.ETHER_ADDRESS : srcToken, srcAmount, destToken, destAmount, swapData, swapCallee, swapCallee, '0', isSrcTokenWeth
75
+ ? {
76
+ callees: [this.dexHelper.config.data.wrappedNativeTokenAddress],
77
+ calldata: [
78
+ this.erc20Interface.encodeFunctionData(types_1.WethFunctions.withdraw, [
79
+ srcAmount,
80
+ ]),
81
+ ],
82
+ values: ['0'],
83
+ }
84
+ : undefined);
85
+ }
86
+ getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
87
+ return {
88
+ targetExchange: constants_1.NULL_ADDRESS,
89
+ payload: '0x',
90
+ networkFee: '0',
91
+ };
92
+ }
93
+ }
94
+ exports.EtherFi = EtherFi;
95
+ EtherFi.dexKeys = ['etherfi'];
96
+ //# sourceMappingURL=etherfi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"etherfi.js","sourceRoot":"","sources":["../../../src/dex/etherfi/etherfi.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA6D;AAC7D,+CAAwE;AAOxE,wDAAoD;AACpD,oFAA0D;AAC1D,8EAAoD;AAEpD,uCAA2C;AAC3C,iDAAuC;AACvC,yCAA8C;AAU9C,IAA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C,CAAC,CAAC,QAAQ,EACzC,SAAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,EACR,UAAU,EACV,UAAU,EACV,GAAG,EACH,cAAc;YACZ,CAAC,CAAC;gBACE,OAAO,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC;gBAC/D,QAAQ,EAAE;oBACR,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,qBAAa,CAAC,QAAQ,EAAE;wBAC7D,SAAS;qBACV,CAAC;iBACH;gBACD,MAAM,EAAE,CAAC,GAAG,CAAC;aACd;YACH,CAAC,CAAC,SAAS,CACd,CAAC;IACJ,CAAC;IAED,eAAe,CACb,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,UAAkB,EAClB,IAAiB,EACjB,IAAc;QAEd,OAAO;YACL,cAAc,EAAE,wBAAY;YAC5B,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,GAAG;SAChB,CAAC;IACJ,CAAC;;AA1HH,0BA2HC;AAvHQ,eAAO,GAAG,CAAC,SAAS,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { DexParams } from './types';
2
+ import { DexConfigMap } from '../../types';
3
+ export declare const FxProtocolConfig: DexConfigMap<DexParams>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FxProtocolConfig = void 0;
4
+ const constants_1 = require("../../constants");
5
+ exports.FxProtocolConfig = {
6
+ FxProtocolRusd: {
7
+ [constants_1.Network.MAINNET]: {
8
+ rUSDAddress: '0x65D72AA8DA931F047169112fcf34f52DbaAE7D18',
9
+ weETHAddress: '0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee',
10
+ rUSDWeETHMarketAddress: '0x267c6a96db7422faa60aa7198ffeeec4169cd65f',
11
+ weETHOracleAddress: '0xddb6f90ffb4d3257dd666b69178e5b3c5bf41136',
12
+ },
13
+ },
14
+ };
15
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/fx-protocol-rusd/config.ts"],"names":[],"mappings":";;;AAEA,+CAAoD;AAEvC,QAAA,gBAAgB,GAA4B;IACvD,cAAc,EAAE;QACd,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,WAAW,EAAE,4CAA4C;YACzD,YAAY,EAAE,4CAA4C;YAC1D,sBAAsB,EAAE,4CAA4C;YACpE,kBAAkB,EAAE,4CAA4C;SACjE;KACF;CACF,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { Interface } from '@ethersproject/abi';
2
+ import { IDexHelper } from '../../dex-helper';
3
+ import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
4
+ import { Address, Log, Logger } from '../../types';
5
+ import { AsyncOrSync, DeepReadonly } from 'ts-essentials';
6
+ import { FxProtocolPoolState } from './types';
7
+ export declare class fxProtocolRusdEvent extends StatefulEventSubscriber<FxProtocolPoolState> {
8
+ protected dexHelper: IDexHelper;
9
+ private marketAddress;
10
+ private marketInterface;
11
+ private weETHOracleAddress;
12
+ private weETHOracleIface;
13
+ decoder: (log: Log) => import("@ethersproject/abi").LogDescription;
14
+ constructor(parentName: string, dexHelper: IDexHelper, marketAddress: Address, marketInterface: Interface, weETHOracleAddress: Address, weETHOracleIface: Interface, logger: Logger);
15
+ protected processLog(state: DeepReadonly<FxProtocolPoolState>, log: Readonly<Log>): AsyncOrSync<DeepReadonly<FxProtocolPoolState> | null>;
16
+ generateState(blockNumber?: number | 'latest'): Promise<DeepReadonly<FxProtocolPoolState>>;
17
+ getPrice(blockNumber: number, amount: bigint, isRedeem: boolean): bigint;
18
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.fxProtocolRusdEvent = void 0;
7
+ const lodash_1 = __importDefault(require("lodash"));
8
+ const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
9
+ const bigint_constants_1 = require("../../bigint-constants");
10
+ const utils_1 = require("../../utils");
11
+ const utils_2 = require("./utils");
12
+ class fxProtocolRusdEvent extends stateful_event_subscriber_1.StatefulEventSubscriber {
13
+ constructor(parentName, dexHelper, marketAddress, marketInterface, weETHOracleAddress, weETHOracleIface, logger) {
14
+ super(parentName, 'fxProtocolRusd', dexHelper, logger);
15
+ this.dexHelper = dexHelper;
16
+ this.marketAddress = marketAddress;
17
+ this.marketInterface = marketInterface;
18
+ this.weETHOracleAddress = weETHOracleAddress;
19
+ this.weETHOracleIface = weETHOracleIface;
20
+ this.decoder = (log) => this.marketInterface.parseLog(log);
21
+ this.addressesSubscribed = [marketAddress, weETHOracleAddress];
22
+ }
23
+ processLog(state, log) {
24
+ const event = this.decoder(log);
25
+ try {
26
+ const _state = lodash_1.default.cloneDeep(state);
27
+ if (event.name === 'UpdateRedeemFeeRatioFToken') {
28
+ _state.redeemFee = (0, utils_1.bigIntify)(event.args.defaultFeeRatio);
29
+ return _state;
30
+ }
31
+ else if (event.name === 'AnswerUpdated') {
32
+ _state.weETHPrice = (0, utils_1.bigIntify)(event.args.current);
33
+ return _state;
34
+ }
35
+ return null;
36
+ }
37
+ catch (e) {
38
+ (0, utils_1.catchParseLogError)(e, this.logger);
39
+ return null;
40
+ }
41
+ }
42
+ async generateState(blockNumber = 'latest') {
43
+ const state = await (0, utils_2.getOnChainState)(this.dexHelper.multiContract, this.marketAddress, this.marketInterface, this.weETHOracleAddress, this.weETHOracleIface, blockNumber);
44
+ return state;
45
+ }
46
+ getPrice(blockNumber, amount, isRedeem) {
47
+ const state = this.getState(blockNumber);
48
+ if (!state)
49
+ throw new Error('Cannot compute price');
50
+ const { nav, redeemFee, weETHPrice } = state;
51
+ const baseTokenPrice = BigInt(weETHPrice * bigint_constants_1.BI_POWS[10]);
52
+ if (isRedeem) {
53
+ return BigInt((amount * nav * (bigint_constants_1.BI_POWS[18] - redeemFee)) /
54
+ bigint_constants_1.BI_POWS[18] /
55
+ baseTokenPrice);
56
+ }
57
+ else {
58
+ return BigInt((baseTokenPrice * amount) / nav);
59
+ }
60
+ }
61
+ }
62
+ exports.fxProtocolRusdEvent = fxProtocolRusdEvent;
63
+ //# sourceMappingURL=fx-protocol-rusd-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fx-protocol-rusd-event.js","sourceRoot":"","sources":["../../../src/dex/fx-protocol-rusd/fx-protocol-rusd-event.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAGvB,+EAA0E;AAI1E,6DAAiD;AACjD,uCAA4D;AAC5D,mCAA0C;AAE1C,MAAa,mBAAoB,SAAQ,mDAA4C;IAGnF,YACE,UAAkB,EACR,SAAqB,EACvB,aAAsB,EACtB,eAA0B,EAC1B,kBAA2B,EAC3B,gBAA2B,EACnC,MAAc;QAEd,KAAK,CAAC,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAP7C,cAAS,GAAT,SAAS,CAAY;QACvB,kBAAa,GAAb,aAAa,CAAS;QACtB,oBAAe,GAAf,eAAe,CAAW;QAC1B,uBAAkB,GAAlB,kBAAkB,CAAS;QAC3B,qBAAgB,GAAhB,gBAAgB,CAAW;QARrC,YAAO,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAYzD,IAAI,CAAC,mBAAmB,GAAG,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;IACjE,CAAC;IAES,UAAU,CAClB,KAAwC,EACxC,GAAkB;QAElB,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI;YACF,MAAM,MAAM,GAAwB,gBAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YACvD,IAAI,KAAK,CAAC,IAAI,KAAK,4BAA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AC;gBACxC,0BAAO,CAAC,EAAE,CAAC;gBACX,cAAc,CACjB,CAAC;SACH;aAAM;YACL,OAAO,MAAM,CAAC,CAAC,cAAc,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC;SAChD;IACH,CAAC;CACF;AApED,kDAoEC"}
@@ -0,0 +1,39 @@
1
+ import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, Logger, NumberAsString, DexExchangeParam, PoolLiquidity } from '../../types';
2
+ import { SwapSide, Network } from '../../constants';
3
+ import { IDex } from '../idex';
4
+ import { IDexHelper } from '../../dex-helper/idex-helper';
5
+ import { DexParams, FxProtocolData } from './types';
6
+ import { SimpleExchange } from '../simple-exchange';
7
+ import { Interface } from '@ethersproject/abi';
8
+ import { fxProtocolRusdEvent } from './fx-protocol-rusd-event';
9
+ export declare class FxProtocolRusd extends SimpleExchange implements IDex<FxProtocolData> {
10
+ readonly network: Network;
11
+ readonly dexKey: string;
12
+ readonly dexHelper: IDexHelper;
13
+ protected config: DexParams;
14
+ readonly hasConstantPriceLargeAmounts = true;
15
+ readonly needWrapNative = false;
16
+ readonly isFeeOnTransferSupported = false;
17
+ static dexKeysWithNetwork: {
18
+ key: string;
19
+ networks: Network[];
20
+ }[];
21
+ fxUSDIface: Interface;
22
+ rUSDMarketIface: Interface;
23
+ weETHOracleIface: Interface;
24
+ fxProtocolRusdPool: fxProtocolRusdEvent;
25
+ logger: Logger;
26
+ constructor(network: Network, dexKey: string, dexHelper: IDexHelper);
27
+ initializePricing(blockNumber: number): Promise<void>;
28
+ getConfig(): DexParams;
29
+ is_weETH(token: string): boolean;
30
+ is_rUSD(token: string): boolean;
31
+ is_rUSD_swap_token(srcToken: string, destToken: string): boolean;
32
+ getAdapters(): null;
33
+ getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
34
+ getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<FxProtocolData>>;
35
+ getCalldataGasCost(poolPrices: PoolPrices<FxProtocolData>): number | number[];
36
+ getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: FxProtocolData, side: SwapSide): AdapterExchangeParam;
37
+ getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: FxProtocolData, side: SwapSide): Promise<DexExchangeParam>;
38
+ getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
39
+ }