@paraswap/dex-lib 3.8.22-infusion.2 → 3.8.22

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 (235) hide show
  1. package/.idea/aws.xml +17 -0
  2. package/.idea/codeStyles/Project.xml +19 -0
  3. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  4. package/.idea/misc.xml +6 -0
  5. package/.idea/modules.xml +8 -0
  6. package/.idea/paraswap-dex-lib.iml +9 -0
  7. package/.idea/prettier.xml +7 -0
  8. package/.idea/vcs.xml +6 -0
  9. package/build/abi/maverick-v2/MaverickV2Router.json +778 -0
  10. package/build/dex/index.js +0 -2
  11. package/build/dex/index.js.map +1 -1
  12. package/build/dex/lite-psm/lite-psm.js +1 -1
  13. package/build/dex/lite-psm/lite-psm.js.map +1 -1
  14. package/build/dex/maker-psm/maker-psm.js +1 -1
  15. package/build/dex/trader-joe-v2.1/optimizer.d.ts +2 -0
  16. package/build/dex/trader-joe-v2.1/optimizer.js +47 -0
  17. package/build/dex/trader-joe-v2.1/optimizer.js.map +1 -0
  18. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +7 -0
  19. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +20 -0
  20. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +1 -0
  21. package/package.json +1 -1
  22. package/src/dex/index.ts +0 -2
  23. package/src/dex/lite-psm/lite-psm.ts +1 -1
  24. package/src/dex/maker-psm/maker-psm.ts +1 -1
  25. package/tests/constants-e2e.ts +1 -1
  26. package/build/abi/AaveV1_lending_pool.json +0 -27
  27. package/build/abi/inception/inception-ineth-pool.json +0 -1062
  28. package/build/abi/inception/inception-ineth.json +0 -609
  29. package/build/abi/inception/inception-ratio-feed.json +0 -93
  30. package/build/abi/inception/inception-vault.json +0 -991
  31. package/build/abi/infusion/InfusionFactory.json +0 -147
  32. package/build/abi/infusion/InfusionPair.json +0 -658
  33. package/build/abi/infusion/InfusionRouter.json +0 -442
  34. package/build/abi/oswap/oswap.abi.json +0 -452
  35. package/build/abi/platypus/asset.json +0 -490
  36. package/build/abi/platypus/avax-pool.json +0 -820
  37. package/build/abi/platypus/oracle.json +0 -119
  38. package/build/abi/platypus/pool.json +0 -677
  39. package/build/abi/smardex/all/smardex-router.json +0 -648
  40. package/build/abi/smardex/layer-1/smardex-factory.json +0 -242
  41. package/build/abi/smardex/layer-1/smardex-pool.json +0 -506
  42. package/build/abi/smardex/layer-2/smardex-factory.json +0 -185
  43. package/build/abi/smardex/layer-2/smardex-pool.json +0 -578
  44. package/build/abi/swaap-v1/pool.json +0 -1346
  45. package/build/dex/aave-v1/aave-v1.d.ts +0 -34
  46. package/build/dex/aave-v1/aave-v1.js +0 -180
  47. package/build/dex/aave-v1/aave-v1.js.map +0 -1
  48. package/build/dex/aave-v1/config.d.ts +0 -11
  49. package/build/dex/aave-v1/config.js +0 -20
  50. package/build/dex/aave-v1/config.js.map +0 -1
  51. package/build/dex/aave-v1/tokens-mainnet.json +0 -134
  52. package/build/dex/aave-v1/tokens.d.ts +0 -3
  53. package/build/dex/aave-v1/tokens.js +0 -50
  54. package/build/dex/aave-v1/tokens.js.map +0 -1
  55. package/build/dex/aave-v1/types.d.ts +0 -12
  56. package/build/dex/aave-v1/types.js +0 -3
  57. package/build/dex/aave-v1/types.js.map +0 -1
  58. package/build/dex/idle-dao/idle-dao-pool.d.ts +0 -56
  59. package/build/dex/idle-dao/idle-dao-pool.js +0 -176
  60. package/build/dex/idle-dao/idle-dao-pool.js.map +0 -1
  61. package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +0 -16
  62. package/build/dex/idle-dao/idle-dao-pooling-pool.js +0 -57
  63. package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +0 -1
  64. package/build/dex/idle-dao/scripts.d.ts +0 -9
  65. package/build/dex/idle-dao/scripts.js +0 -552
  66. package/build/dex/idle-dao/scripts.js.map +0 -1
  67. package/build/dex/inception/config.d.ts +0 -5
  68. package/build/dex/inception/config.js +0 -112
  69. package/build/dex/inception/config.js.map +0 -1
  70. package/build/dex/inception/inception-event-pool.d.ts +0 -23
  71. package/build/dex/inception/inception-event-pool.js +0 -34
  72. package/build/dex/inception/inception-event-pool.js.map +0 -1
  73. package/build/dex/inception/inception-native.d.ts +0 -43
  74. package/build/dex/inception/inception-native.js +0 -131
  75. package/build/dex/inception/inception-native.js.map +0 -1
  76. package/build/dex/inception/inception-pool.d.ts +0 -18
  77. package/build/dex/inception/inception-pool.js +0 -32
  78. package/build/dex/inception/inception-pool.js.map +0 -1
  79. package/build/dex/inception/inception-price-feed.d.ts +0 -19
  80. package/build/dex/inception/inception-price-feed.js +0 -51
  81. package/build/dex/inception/inception-price-feed.js.map +0 -1
  82. package/build/dex/inception/inception.d.ts +0 -44
  83. package/build/dex/inception/inception.js +0 -162
  84. package/build/dex/inception/inception.js.map +0 -1
  85. package/build/dex/inception/tokens.d.ts +0 -9
  86. package/build/dex/inception/tokens.js +0 -28
  87. package/build/dex/inception/tokens.js.map +0 -1
  88. package/build/dex/inception/types.d.ts +0 -22
  89. package/build/dex/inception/types.js +0 -3
  90. package/build/dex/inception/types.js.map +0 -1
  91. package/build/dex/inception/utils.d.ts +0 -7
  92. package/build/dex/inception/utils.js +0 -58
  93. package/build/dex/inception/utils.js.map +0 -1
  94. package/build/dex/infusion/config.d.ts +0 -4
  95. package/build/dex/infusion/config.js +0 -25
  96. package/build/dex/infusion/config.js.map +0 -1
  97. package/build/dex/infusion/infusion-stable-pool.d.ts +0 -4
  98. package/build/dex/infusion/infusion-stable-pool.js +0 -74
  99. package/build/dex/infusion/infusion-stable-pool.js.map +0 -1
  100. package/build/dex/infusion/infusion.d.ts +0 -57
  101. package/build/dex/infusion/infusion.js +0 -477
  102. package/build/dex/infusion/infusion.js.map +0 -1
  103. package/build/dex/infusion/types.d.ts +0 -47
  104. package/build/dex/infusion/types.js +0 -3
  105. package/build/dex/infusion/types.js.map +0 -1
  106. package/build/dex/infusion/utils/isStablePair.d.ts +0 -2
  107. package/build/dex/infusion/utils/isStablePair.js +0 -18
  108. package/build/dex/infusion/utils/isStablePair.js.map +0 -1
  109. package/build/dex/oswap/config.d.ts +0 -5
  110. package/build/dex/oswap/config.js +0 -31
  111. package/build/dex/oswap/config.js.map +0 -1
  112. package/build/dex/oswap/oswap-pool.d.ts +0 -51
  113. package/build/dex/oswap/oswap-pool.js +0 -150
  114. package/build/dex/oswap/oswap-pool.js.map +0 -1
  115. package/build/dex/oswap/oswap.d.ts +0 -46
  116. package/build/dex/oswap/oswap.js +0 -273
  117. package/build/dex/oswap/oswap.js.map +0 -1
  118. package/build/dex/oswap/types.d.ts +0 -20
  119. package/build/dex/oswap/types.js +0 -3
  120. package/build/dex/oswap/types.js.map +0 -1
  121. package/build/dex/platypus/asset.d.ts +0 -14
  122. package/build/dex/platypus/asset.js +0 -97
  123. package/build/dex/platypus/asset.js.map +0 -1
  124. package/build/dex/platypus/config.d.ts +0 -11
  125. package/build/dex/platypus/config.js +0 -69
  126. package/build/dex/platypus/config.js.map +0 -1
  127. package/build/dex/platypus/platypus.d.ts +0 -63
  128. package/build/dex/platypus/platypus.js +0 -473
  129. package/build/dex/platypus/platypus.js.map +0 -1
  130. package/build/dex/platypus/pool-avax.d.ts +0 -8
  131. package/build/dex/platypus/pool-avax.js +0 -54
  132. package/build/dex/platypus/pool-avax.js.map +0 -1
  133. package/build/dex/platypus/pool-base.d.ts +0 -19
  134. package/build/dex/platypus/pool-base.js +0 -86
  135. package/build/dex/platypus/pool-base.js.map +0 -1
  136. package/build/dex/platypus/pool-pure.d.ts +0 -8
  137. package/build/dex/platypus/pool-pure.js +0 -37
  138. package/build/dex/platypus/pool-pure.js.map +0 -1
  139. package/build/dex/platypus/pool-subscriber.d.ts +0 -14
  140. package/build/dex/platypus/pool-subscriber.js +0 -167
  141. package/build/dex/platypus/pool-subscriber.js.map +0 -1
  142. package/build/dex/platypus/pool.d.ts +0 -8
  143. package/build/dex/platypus/pool.js +0 -58
  144. package/build/dex/platypus/pool.js.map +0 -1
  145. package/build/dex/platypus/types.d.ts +0 -92
  146. package/build/dex/platypus/types.js +0 -10
  147. package/build/dex/platypus/types.js.map +0 -1
  148. package/build/dex/quickswap/spiritswap-v3.d.ts +0 -6
  149. package/build/dex/quickswap/spiritswap-v3.js +0 -19
  150. package/build/dex/quickswap/spiritswap-v3.js.map +0 -1
  151. package/build/dex/smardex/config.d.ts +0 -4
  152. package/build/dex/smardex/config.js +0 -64
  153. package/build/dex/smardex/config.js.map +0 -1
  154. package/build/dex/smardex/constants.d.ts +0 -18
  155. package/build/dex/smardex/constants.js +0 -33
  156. package/build/dex/smardex/constants.js.map +0 -1
  157. package/build/dex/smardex/sdk/constants.d.ts +0 -6
  158. package/build/dex/smardex/sdk/constants.js +0 -13
  159. package/build/dex/smardex/sdk/constants.js.map +0 -1
  160. package/build/dex/smardex/sdk/core.d.ts +0 -113
  161. package/build/dex/smardex/sdk/core.js +0 -499
  162. package/build/dex/smardex/sdk/core.js.map +0 -1
  163. package/build/dex/smardex/sdk/errors.d.ts +0 -15
  164. package/build/dex/smardex/sdk/errors.js +0 -22
  165. package/build/dex/smardex/sdk/errors.js.map +0 -1
  166. package/build/dex/smardex/sdk/types.d.ts +0 -62
  167. package/build/dex/smardex/sdk/types.js +0 -3
  168. package/build/dex/smardex/sdk/types.js.map +0 -1
  169. package/build/dex/smardex/sdk/utils.d.ts +0 -44
  170. package/build/dex/smardex/sdk/utils.js +0 -133
  171. package/build/dex/smardex/sdk/utils.js.map +0 -1
  172. package/build/dex/smardex/smardex-event-pool.d.ts +0 -28
  173. package/build/dex/smardex/smardex-event-pool.js +0 -119
  174. package/build/dex/smardex/smardex-event-pool.js.map +0 -1
  175. package/build/dex/smardex/smardex.d.ts +0 -65
  176. package/build/dex/smardex/smardex.js +0 -519
  177. package/build/dex/smardex/smardex.js.map +0 -1
  178. package/build/dex/smardex/types.d.ts +0 -55
  179. package/build/dex/smardex/types.js +0 -3
  180. package/build/dex/smardex/types.js.map +0 -1
  181. package/build/dex/solidly/forks-override/cone.d.ts +0 -22
  182. package/build/dex/solidly/forks-override/cone.js +0 -53
  183. package/build/dex/solidly/forks-override/cone.js.map +0 -1
  184. package/build/dex/solidly/forks-override/solisnek.d.ts +0 -8
  185. package/build/dex/solidly/forks-override/solisnek.js +0 -15
  186. package/build/dex/solidly/forks-override/solisnek.js.map +0 -1
  187. package/build/dex/swaap-v1/config.d.ts +0 -17
  188. package/build/dex/swaap-v1/config.js +0 -56
  189. package/build/dex/swaap-v1/config.js.map +0 -1
  190. package/build/dex/swaap-v1/constants.d.ts +0 -6
  191. package/build/dex/swaap-v1/constants.js +0 -17
  192. package/build/dex/swaap-v1/constants.js.map +0 -1
  193. package/build/dex/swaap-v1/libraries/ChainlinkUtils.d.ts +0 -25
  194. package/build/dex/swaap-v1/libraries/ChainlinkUtils.js +0 -62
  195. package/build/dex/swaap-v1/libraries/ChainlinkUtils.js.map +0 -1
  196. package/build/dex/swaap-v1/libraries/Const.d.ts +0 -18
  197. package/build/dex/swaap-v1/libraries/Const.js +0 -26
  198. package/build/dex/swaap-v1/libraries/Const.js.map +0 -1
  199. package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.d.ts +0 -77
  200. package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js +0 -316
  201. package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js.map +0 -1
  202. package/build/dex/swaap-v1/libraries/LogExpMath.d.ts +0 -75
  203. package/build/dex/swaap-v1/libraries/LogExpMath.js +0 -418
  204. package/build/dex/swaap-v1/libraries/LogExpMath.js.map +0 -1
  205. package/build/dex/swaap-v1/libraries/MathMMM.d.ts +0 -185
  206. package/build/dex/swaap-v1/libraries/MathMMM.js +0 -453
  207. package/build/dex/swaap-v1/libraries/MathMMM.js.map +0 -1
  208. package/build/dex/swaap-v1/libraries/Num.d.ts +0 -31
  209. package/build/dex/swaap-v1/libraries/Num.js +0 -167
  210. package/build/dex/swaap-v1/libraries/Num.js.map +0 -1
  211. package/build/dex/swaap-v1/libraries/PoolQuotations.d.ts +0 -23
  212. package/build/dex/swaap-v1/libraries/PoolQuotations.js +0 -131
  213. package/build/dex/swaap-v1/libraries/PoolQuotations.js.map +0 -1
  214. package/build/dex/swaap-v1/libraries/Struct.d.ts +0 -56
  215. package/build/dex/swaap-v1/libraries/Struct.js +0 -3
  216. package/build/dex/swaap-v1/libraries/Struct.js.map +0 -1
  217. package/build/dex/swaap-v1/swaap-v1-pool.d.ts +0 -45
  218. package/build/dex/swaap-v1/swaap-v1-pool.js +0 -656
  219. package/build/dex/swaap-v1/swaap-v1-pool.js.map +0 -1
  220. package/build/dex/swaap-v1/swaap-v1.d.ts +0 -62
  221. package/build/dex/swaap-v1/swaap-v1.js +0 -379
  222. package/build/dex/swaap-v1/swaap-v1.js.map +0 -1
  223. package/build/dex/swaap-v1/types.d.ts +0 -106
  224. package/build/dex/swaap-v1/types.js +0 -9
  225. package/build/dex/swaap-v1/types.js.map +0 -1
  226. package/src/abi/infusion/InfusionFactory.json +0 -147
  227. package/src/abi/infusion/InfusionPair.json +0 -658
  228. package/src/abi/infusion/InfusionRouter.json +0 -442
  229. package/src/dex/infusion/config.ts +0 -27
  230. package/src/dex/infusion/infusion-e2e.test.ts +0 -110
  231. package/src/dex/infusion/infusion-integration.test.ts +0 -232
  232. package/src/dex/infusion/infusion-stable-pool.ts +0 -91
  233. package/src/dex/infusion/infusion.ts +0 -695
  234. package/src/dex/infusion/types.ts +0 -60
  235. package/src/dex/infusion/utils/isStablePair.ts +0 -18
@@ -1,34 +0,0 @@
1
- import { Interface } from '@ethersproject/abi';
2
- import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, SimpleExchangeParam, PoolLiquidity, Logger, NumberAsString, DexExchangeParam } from '../../types';
3
- import { SwapSide, Network } from '../../constants';
4
- import { IDex } from '../../dex/idex';
5
- import { IDexHelper } from '../../dex-helper/idex-helper';
6
- import { AaveV1Data, AaveV1Param } from './types';
7
- import { SimpleExchange } from '../simple-exchange';
8
- export declare class AaveV1 extends SimpleExchange implements IDex<AaveV1Data, AaveV1Param> {
9
- protected network: Network;
10
- protected dexHelper: IDexHelper;
11
- readonly hasConstantPriceLargeAmounts = true;
12
- readonly isFeeOnTransferSupported = false;
13
- static dexKeysWithNetwork: {
14
- key: string;
15
- networks: Network[];
16
- }[];
17
- logger: Logger;
18
- aavePool: Interface;
19
- aContract: Interface;
20
- constructor(network: Network, dexKey: string, dexHelper: IDexHelper);
21
- initializePricing(blockNumber: number): Promise<void>;
22
- getAdapters(side: SwapSide): {
23
- name: string;
24
- index: number;
25
- }[] | null;
26
- getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
27
- getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<AaveV1Data>>;
28
- getCalldataGasCost(poolPrices: PoolPrices<AaveV1Data>): number | number[];
29
- getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: AaveV1Data, side: SwapSide): AdapterExchangeParam;
30
- getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: AaveV1Data, side: SwapSide): Promise<SimpleExchangeParam>;
31
- getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: AaveV1Data, side: SwapSide): DexExchangeParam;
32
- updatePoolState(): Promise<void>;
33
- getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
34
- }
@@ -1,180 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.AaveV1 = void 0;
30
- const abi_1 = require("@ethersproject/abi");
31
- const constants_1 = require("../../constants");
32
- const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
33
- const utils_1 = require("../../utils");
34
- const simple_exchange_1 = require("../simple-exchange");
35
- const config_1 = require("./config");
36
- const AaveV1_lending_pool_json_1 = __importDefault(require("../../abi/AaveV1_lending_pool.json"));
37
- const erc20_json_1 = __importDefault(require("../../abi/erc20.json"));
38
- const tokens_1 = require("./tokens");
39
- const AaveGasCost = 400 * 1000;
40
- var AaveV1Functions;
41
- (function (AaveV1Functions) {
42
- AaveV1Functions["deposit"] = "deposit";
43
- AaveV1Functions["redeem"] = "redeem";
44
- })(AaveV1Functions || (AaveV1Functions = {}));
45
- const AAVE_LENDING_POOL = '0x398eC7346DcD622eDc5ae82352F02bE94C62d119';
46
- const AAVE_PROXY = '0x3dfd23a6c5e8bbcfc9581d2e864a68feb6a076d3';
47
- const REF_CODE = 1;
48
- class AaveV1 extends simple_exchange_1.SimpleExchange {
49
- constructor(network, dexKey, dexHelper) {
50
- super(dexHelper, dexKey);
51
- this.network = network;
52
- this.dexHelper = dexHelper;
53
- this.hasConstantPriceLargeAmounts = true;
54
- this.isFeeOnTransferSupported = false;
55
- this.logger = dexHelper.getLogger(dexKey);
56
- this.aavePool = new abi_1.Interface(AaveV1_lending_pool_json_1.default);
57
- this.aContract = new abi_1.Interface(erc20_json_1.default);
58
- }
59
- async initializePricing(blockNumber) { }
60
- // Returns the list of contract adapters (name and index)
61
- // for a buy/sell. Return null if there are no adapters.
62
- getAdapters(side) {
63
- return config_1.Adapters[this.network][side];
64
- }
65
- // Returns list of pool identifiers that can be used
66
- // for a given swap. poolIdentifiers must be unique
67
- // across DEXes. It is recommended to use
68
- // ${dexKey}_${poolAddress} as a poolIdentifier
69
- async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
70
- const aToken = (0, tokens_1.isAAVEPair)(this.network, srcToken, destToken);
71
- if (aToken === null) {
72
- return [];
73
- }
74
- return [`${this.dexKey}_${aToken.address}`];
75
- }
76
- // Returns pool prices for amounts.
77
- // If limitPools is defined only pools in limitPools
78
- // should be used. If limitPools is undefined then
79
- // any pools can be used.
80
- async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
81
- const aToken = (0, tokens_1.isAAVEPair)(this.network, srcToken, destToken);
82
- if (!aToken) {
83
- return null;
84
- }
85
- const fromAToken = aToken == srcToken;
86
- return [
87
- {
88
- prices: amounts,
89
- unit: (0, utils_1.getBigIntPow)((side === constants_1.SwapSide.SELL ? destToken : srcToken).decimals),
90
- gasCost: AaveGasCost,
91
- exchange: this.dexKey,
92
- data: {
93
- fromAToken,
94
- isV2: false,
95
- },
96
- poolAddresses: [fromAToken ? srcToken.address : destToken.address],
97
- },
98
- ];
99
- }
100
- // Returns estimated gas cost of calldata for this DEX in multiSwap
101
- getCalldataGasCost(poolPrices) {
102
- return (CALLDATA_GAS_COST.DEX_OVERHEAD +
103
- CALLDATA_GAS_COST.LENGTH_SMALL +
104
- CALLDATA_GAS_COST.ADDRESS);
105
- }
106
- // Encode params required by the exchange adapter
107
- // Used for multiSwap, buy & megaSwap
108
- getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
109
- const aToken = data.fromAToken ? srcToken : destToken; // Warning
110
- const payload = this.abiCoder.encodeParameter({
111
- ParentStruct: {
112
- aToken: 'address',
113
- },
114
- }, { aToken });
115
- return {
116
- targetExchange: AAVE_LENDING_POOL,
117
- payload,
118
- networkFee: '0',
119
- };
120
- }
121
- // Encode call data used by simpleSwap like routers
122
- // Used for simpleSwap & simpleBuy
123
- // Hint: this.buildSimpleParamWithoutWETHConversion
124
- // could be useful
125
- async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
126
- const amount = side === constants_1.SwapSide.SELL ? srcAmount : destAmount;
127
- const [Interface, swapFunction, swapFunctionParams, swapCallee, spender] = (() => {
128
- if (data.fromAToken) {
129
- return [this.aContract, AaveV1Functions.redeem, [amount], srcToken];
130
- }
131
- return [
132
- this.aavePool,
133
- AaveV1Functions.deposit,
134
- [srcToken, amount, REF_CODE],
135
- AAVE_LENDING_POOL,
136
- AAVE_PROXY, // warning
137
- ];
138
- })();
139
- const swapData = Interface.encodeFunctionData(swapFunction, swapFunctionParams);
140
- return this.buildSimpleParamWithoutWETHConversion(srcToken, amount, destToken, destAmount, swapData, swapCallee, spender);
141
- }
142
- // DEAD
143
- getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
144
- const amount = side === constants_1.SwapSide.SELL ? srcAmount : destAmount;
145
- const [Interface, swapFunction, swapFunctionParams, swapCallee] = (() => {
146
- if (data.fromAToken) {
147
- return [this.aContract, AaveV1Functions.redeem, [amount], srcToken];
148
- }
149
- return [
150
- this.aavePool,
151
- AaveV1Functions.deposit,
152
- [srcToken, amount, REF_CODE],
153
- AAVE_LENDING_POOL,
154
- ];
155
- })();
156
- const exchangeData = Interface.encodeFunctionData(swapFunction, swapFunctionParams);
157
- return {
158
- needWrapNative: this.needWrapNative,
159
- dexFuncHasRecipient: false,
160
- exchangeData,
161
- targetExchange: swapCallee,
162
- };
163
- }
164
- // This is called once before getTopPoolsForToken is
165
- // called for multiple tokens. This can be helpful to
166
- // update common state required for calculating
167
- // getTopPoolsForToken. It is optional for a DEX
168
- // to implement this
169
- updatePoolState() {
170
- return Promise.resolve();
171
- }
172
- // Returns list of top pools based on liquidity. Max
173
- // limit number pools should be returned.
174
- async getTopPoolsForToken(tokenAddress, limit) {
175
- return [];
176
- }
177
- }
178
- exports.AaveV1 = AaveV1;
179
- AaveV1.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.AaveV1Config);
180
- //# sourceMappingURL=aave-v1.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aave-v1.js","sourceRoot":"","sources":["../../../src/dex/aave-v1/aave-v1.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA6D;AAa7D,+CAAoD;AACpD,2EAA6D;AAC7D,uCAAkE;AAIlE,wDAAoD;AACpD,qCAAkD;AAClD,kGAA0E;AAC1E,sEAAyC;AACzC,qCAAsC;AAEtC,MAAM,WAAW,GAAG,GAAG,GAAG,IAAI,CAAC;AAE/B,IAAK,eAGJ;AAHD,WAAK,eAAe;IAClB,sCAAmB,CAAA;IACnB,oCAAiB,CAAA;AACnB,CAAC,EAHI,eAAe,KAAf,eAAe,QAGnB;AAED,MAAM,iBAAiB,GAAG,4CAA4C,CAAC;AACvE,MAAM,UAAU,GAAG,4CAA4C,CAAC;AAChE,MAAM,QAAQ,GAAG,CAAC,CAAC;AAEnB,MAAa,MACX,SAAQ,gCAAc;IAatB,YACY,OAAgB,EAC1B,MAAc,EACJ,SAAqB;QAE/B,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAJf,YAAO,GAAP,OAAO,CAAS;QAEhB,cAAS,GAAT,SAAS,CAAY;QAbxB,iCAA4B,GAAG,IAAI,CAAC;QACpC,6BAAwB,GAAG,KAAK,CAAC;QAexC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,QAAQ,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B,iBAAiB;aAClB,CAAC;QACJ,CAAC,CAAC,EAAE,CAAC;QAEL,MAAM,YAAY,GAAG,SAAS,CAAC,kBAAkB,CAC/C,YAAY,EACZ,kBAAkB,CACnB,CAAC;QAEF,OAAO;YACL,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,mBAAmB,EAAE,KAAK;YAC1B,YAAY;YACZ,cAAc,EAAE,UAAU;SAC3B,CAAC;IACJ,CAAC;IAED,oDAAoD;IACpD,qDAAqD;IACrD,+CAA+C;IAC/C,gDAAgD;IAChD,oBAAoB;IACpB,eAAe;QACb,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,oDAAoD;IACpD,yCAAyC;IACzC,KAAK,CAAC,mBAAmB,CACvB,YAAqB,EACrB,KAAa;QAEb,OAAO,EAAE,CAAC;IACZ,CAAC;;AA9NH,wBA+NC;AAxNe,yBAAkB,GAC9B,IAAA,6BAAqB,EAAC,qBAAY,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- import { DexParams } from './types';
2
- import { DexConfigMap } from '../../types';
3
- export declare const AaveV1Config: DexConfigMap<DexParams>;
4
- export declare const Adapters: {
5
- [chainId: number]: {
6
- [side: string]: {
7
- name: string;
8
- index: number;
9
- }[];
10
- };
11
- };
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Adapters = exports.AaveV1Config = void 0;
4
- const constants_1 = require("../../constants");
5
- exports.AaveV1Config = {
6
- AaveV1: {
7
- [constants_1.Network.MAINNET]: {},
8
- },
9
- };
10
- exports.Adapters = {
11
- [constants_1.Network.MAINNET]: {
12
- [constants_1.SwapSide.SELL]: [
13
- {
14
- name: 'Adapter03',
15
- index: 5,
16
- },
17
- ],
18
- },
19
- };
20
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/aave-v1/config.ts"],"names":[],"mappings":";;;AAEA,+CAAoD;AAEvC,QAAA,YAAY,GAA4B;IACnD,MAAM,EAAE;QACN,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE,EAAE;KACtB;CACF,CAAC;AAEW,QAAA,QAAQ,GAEjB;IACF,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;QACjB,CAAC,oBAAQ,CAAC,IAAI,CAAC,EAAE;YACf;gBACE,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,CAAC;aACT;SACF;KACF;CACF,CAAC"}
@@ -1,134 +0,0 @@
1
- [
2
- {
3
- "aSymbol": "aETH",
4
- "aAddress": "0x3a3a65aab0dd2a17e3f1947ba16138cd37d08c04",
5
- "address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
6
- "decimals": 18
7
- },
8
- {
9
- "aSymbol": "aDAI",
10
- "aAddress": "0xfc1e690f61efd961294b3e1ce3313fbd8aa4f85d",
11
- "address": "0x6b175474e89094c44da98b954eedeac495271d0f",
12
- "decimals": 18
13
- },
14
- {
15
- "aSymbol": "aUSDC",
16
- "aAddress": "0x9ba00d6856a4edf4665bca2c2309936572473b7e",
17
- "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
18
- "decimals": 6
19
- },
20
- {
21
- "aSymbol": "aSUSD",
22
- "aAddress": "0x625ae63000f46200499120b906716420bd059240",
23
- "address": "0x57ab1e02fee23774580c119740129eac7081e9d3",
24
- "decimals": 18
25
- },
26
- {
27
- "aSymbol": "aTUSD",
28
- "aAddress": "0x4da9b813057d04baef4e5800e36083717b4a0341",
29
- "address": "0x8dd5fbce2f6a956c3022ba3663759011dd51e73e",
30
- "decimals": 18
31
- },
32
- {
33
- "aSymbol": "aUSDT",
34
- "aAddress": "0x71fc860f7d3a592a4a98740e39db31d25db65ae8",
35
- "address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
36
- "decimals": 6
37
- },
38
- {
39
- "aSymbol": "aBUSD",
40
- "aAddress": "0x6ee0f7bb50a54ab5253da0667b0dc2ee526c30a8",
41
- "address": "0x4fabb145d64652a948d72533023f6e7a623c7c53",
42
- "decimals": 18
43
- },
44
- {
45
- "aSymbol": "aBAT",
46
- "aAddress": "0xe1ba0fb44ccb0d11b80f92f4f8ed94ca3ff51d00",
47
- "address": "0x0d8775f648430679a709e98d2b0cb6250d2887ef",
48
- "decimals": 18
49
- },
50
- {
51
- "aSymbol": "aENJ",
52
- "aAddress": "0x712db54daa836b53ef1ecbb9c6ba3b9efb073f40",
53
- "address": "0xf629cbd94d3791c9250152bd8dfbdf380e2a3b9c",
54
- "decimals": 18
55
- },
56
- {
57
- "aSymbol": "aKNC",
58
- "aAddress": "0x9d91be44c06d373a8a226e1f3b146956083803eb",
59
- "address": "0xdd974d5c2e2928dea5f71b9825b8b646686bd200",
60
- "decimals": 18
61
- },
62
- {
63
- "aSymbol": "aAAVE",
64
- "aAddress": "0xba3d9687cf50fe253cd2e1cfeede1d6787344ed5",
65
- "address": "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9",
66
- "decimals": 18
67
- },
68
- {
69
- "aSymbol": "aLINK",
70
- "aAddress": "0xa64bd6c70cb9051f6a9ba1f163fdc07e0dfb5f84",
71
- "address": "0x514910771af9ca656af840dff83e8264ecf986ca",
72
- "decimals": 18
73
- },
74
- {
75
- "aSymbol": "aMANA",
76
- "aAddress": "0x6fce4a401b6b80ace52baaefe4421bd188e76f6f",
77
- "address": "0x0f5d2fb29fb7d3cfee444a200298f468908cc942",
78
- "decimals": 18
79
- },
80
- {
81
- "aSymbol": "aMKR",
82
- "aAddress": "0x7deb5e830be29f91e298ba5ff1356bb7f8146998",
83
- "address": "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2",
84
- "decimals": 18
85
- },
86
- {
87
- "aSymbol": "aREN",
88
- "aAddress": "0x69948cc03f478b95283f7dbf1ce764d0fc7ec54c",
89
- "address": "0x408e41876cccdc0f92210600ef50372656052a38",
90
- "decimals": 18
91
- },
92
- {
93
- "aSymbol": "aREP",
94
- "aAddress": "0x71010a9d003445ac60c4e6a7017c1e89a477b438",
95
- "address": "0xe94327d07fc17907b4db788e5adf2ed424addff6",
96
- "decimals": 18
97
- },
98
- {
99
- "aSymbol": "aSNX",
100
- "aAddress": "0x328c4c80bc7aca0834db37e6600a6c49e12da4de",
101
- "address": "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f",
102
- "decimals": 18
103
- },
104
- {
105
- "aSymbol": "aUNI",
106
- "aAddress": "0xb124541127a0a657f056d9dd06188c4f1b0e5aab",
107
- "address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
108
- "decimals": 18
109
- },
110
- {
111
- "aSymbol": "aWBTC",
112
- "aAddress": "0xfc4b8ed459e00e5400be803a9bb3954234fd50e3",
113
- "address": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
114
- "decimals": 8
115
- },
116
- {
117
- "aSymbol": "aYFI",
118
- "aAddress": "0x12e51e77daaa58aa0e9247db7510ea4b46f9bead",
119
- "address": "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e",
120
- "decimals": 18
121
- },
122
- {
123
- "aSymbol": "aZRX",
124
- "aAddress": "0x6fb0855c404e09c47c3fbca25f08d4e41f9f062f",
125
- "address": "0xe41d2489571d322189246dafa5ebde1f4699f498",
126
- "decimals": 18
127
- },
128
- {
129
- "aSymbol": "aLEND",
130
- "aAddress": "0x7d2d3688df45ce7c552e19c27e007673da9204b8",
131
- "address": "0x80fb784b7ed66730e8b1dbd9820afd29931aab03",
132
- "decimals": 18
133
- }
134
- ]
@@ -1,3 +0,0 @@
1
- import { Token } from '../../types';
2
- export declare function isAAVEPair(network: number, src: Token, dst: Token): Token | null;
3
- export declare function aaveV1GetToken(network: number, symbol: string): Token | null;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.aaveV1GetToken = exports.isAAVEPair = void 0;
7
- const constants_1 = require("../../constants");
8
- const tokens_mainnet_json_1 = __importDefault(require("./tokens-mainnet.json"));
9
- const Tokens = {};
10
- const TokensByAddress = {};
11
- const tokensByNetwork = {
12
- [constants_1.Network.MAINNET]: tokens_mainnet_json_1.default,
13
- };
14
- for (const [key, tokens] of Object.entries(tokensByNetwork)) {
15
- const network = +key;
16
- Tokens[network] = {};
17
- TokensByAddress[network] = {};
18
- for (const token of tokens) {
19
- Tokens[network][token.aSymbol] = token;
20
- TokensByAddress[network][token.aAddress.toLowerCase()] = token;
21
- }
22
- }
23
- // return null if pair does not exists otherwise return the aToken
24
- function isAAVEPair(network, src, dst) {
25
- const srcAddr = src.address.toLowerCase();
26
- const dstAddr = dst.address.toLowerCase();
27
- const _src = TokensByAddress[network][srcAddr];
28
- const _dst = TokensByAddress[network][dstAddr];
29
- if (_src && _src.address == dstAddr) {
30
- return src;
31
- }
32
- if (_dst && _dst.address == srcAddr) {
33
- return dst;
34
- }
35
- return null;
36
- }
37
- exports.isAAVEPair = isAAVEPair;
38
- function aaveV1GetToken(network, symbol) {
39
- const aToken = Tokens[network][symbol];
40
- if (!aToken) {
41
- return null;
42
- }
43
- return {
44
- address: aToken.aAddress,
45
- decimals: aToken.decimals,
46
- symbol: aToken.aSymbol,
47
- };
48
- }
49
- exports.aaveV1GetToken = aaveV1GetToken;
50
- //# sourceMappingURL=tokens.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/dex/aave-v1/tokens.ts"],"names":[],"mappings":";;;;;;AACA,+CAA0C;AAE1C,gFAAkD;AAElD,MAAM,MAAM,GAAwD,EAAE,CAAC;AACvE,MAAM,eAAe,GACnB,EAAE,CAAC;AAEL,MAAM,eAAe,GAA+B;IAClD,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE,6BAAa;CACjC,CAAC;AAEF,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,MAAM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C,QAAQ;QACzB,MAAM,EAAE,MAAM,CAAC,OAAO;KACvB,CAAC;AACJ,CAAC;AAXD,wCAWC"}
@@ -1,12 +0,0 @@
1
- export declare type AaveV1Data = {
2
- fromAToken: boolean;
3
- isV2: boolean;
4
- };
5
- export declare type DexParams = {};
6
- export declare type AaveV1RedeemParams = [
7
- _reserve: string,
8
- _amount: string,
9
- _referralCode: number
10
- ];
11
- export declare type AaveV1DepositParams = [token: string];
12
- export declare type AaveV1Param = AaveV1RedeemParams | AaveV1DepositParams;
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/aave-v1/types.ts"],"names":[],"mappings":""}
@@ -1,56 +0,0 @@
1
- import BigNumber from 'bignumber.js';
2
- import { Contract } from 'web3-eth-contract';
3
- import { Interface } from '@ethersproject/abi';
4
- import { DeepReadonly } from 'ts-essentials';
5
- import { Log, Logger } from '../../types';
6
- import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
7
- import { IDexHelper } from '../../dex-helper/idex-helper';
8
- import { PoolState, IdleToken } from './types';
9
- import { IdleDao } from './idle-dao';
10
- declare type BlocksTransfers = Record<number, {
11
- underlyingAmount: BigNumber;
12
- idleAmount: BigNumber;
13
- processed: boolean;
14
- }>;
15
- export declare class IdleDaoEventPool extends StatefulEventSubscriber<PoolState> {
16
- readonly parentName: string;
17
- protected network: number;
18
- protected dexHelper: IDexHelper;
19
- protected logger: Logger;
20
- protected idleToken: IdleToken;
21
- protected IdleDao: IdleDao;
22
- handlers: {
23
- [event: string]: (event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>) => Promise<DeepReadonly<PoolState> | null>;
24
- };
25
- logDecoder: (log: Log) => any;
26
- cdoContract: Contract;
27
- poolInterface: Interface;
28
- addressesSubscribed: string[];
29
- blocksTransfers: BlocksTransfers;
30
- constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, idleToken: IdleToken, IdleDao: IdleDao);
31
- /**
32
- * The function is called every time any of the subscribed
33
- * addresses release log. The function accepts the current
34
- * state, updates the state according to the log, and returns
35
- * the updated state.
36
- * @param state - Current state of event subscriber
37
- * @param log - Log released by one of the subscribed addresses
38
- * @returns Updates state of the event subscriber after the log
39
- */
40
- protected processLog(state: DeepReadonly<PoolState>, log: Readonly<Log>): Promise<DeepReadonly<PoolState> | null>;
41
- /**
42
- * The function generates state using on-chain calls. This
43
- * function is called to regenerate state if the event based
44
- * system fails to fetch events and the local state is no
45
- * more correct.
46
- * @param blockNumber - Blocknumber for which the state should
47
- * should be generated
48
- * @returns state of the event subscriber at blocknumber
49
- */
50
- generateState(blockNumber: number): Promise<DeepReadonly<PoolState>>;
51
- setBlockState(blockNumber: number, state: PoolState): void;
52
- handleCoinTransfer(event: any, state: PoolState, log: Log): Promise<DeepReadonly<PoolState> | null>;
53
- processBlockTransfer(blockNumber: number, state: PoolState): PoolState;
54
- handleCoinTransfer_old(event: any, state: PoolState, log: Log): Promise<DeepReadonly<PoolState> | null>;
55
- }
56
- export {};