@paraswap/dex-lib 3.7.2 → 3.7.3-idle

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 (251) hide show
  1. package/build/abi/Redstone.json +739 -0
  2. package/build/abi/aavev3stata/Factory.json +128 -0
  3. package/build/abi/aavev3stata/Token.json +735 -0
  4. package/build/abi/angle-transmuter/MorphoOracle.json +193 -0
  5. package/build/abi/angle-transmuter/MorphoVault.json +2506 -0
  6. package/build/abi/angle-transmuter/Pyth.json +1534 -0
  7. package/build/abi/angle-transmuter/Transmuter.json +1711 -0
  8. package/build/abi/angle-transmuter/TransmuterSidechain.json +1798 -0
  9. package/build/abi/idle-dao/idle-cdo-factory.json +38 -0
  10. package/build/abi/idle-dao/idle-cdo.json +1245 -0
  11. package/build/config.js +2 -0
  12. package/build/config.js.map +1 -1
  13. package/build/dex/aave-v1/aave-v1.d.ts +2 -1
  14. package/build/dex/aave-v1/aave-v1.js +22 -0
  15. package/build/dex/aave-v1/aave-v1.js.map +1 -1
  16. package/build/dex/aave-v3-stata/aave-v3-stata.d.ts +50 -0
  17. package/build/dex/aave-v3-stata/aave-v3-stata.js +385 -0
  18. package/build/dex/aave-v3-stata/aave-v3-stata.js.map +1 -0
  19. package/build/dex/aave-v3-stata/config.d.ts +4 -0
  20. package/build/dex/aave-v3-stata/config.js +50 -0
  21. package/build/dex/aave-v3-stata/config.js.map +1 -0
  22. package/build/dex/aave-v3-stata/tokens.d.ts +10 -0
  23. package/build/dex/aave-v3-stata/tokens.js +43 -0
  24. package/build/dex/aave-v3-stata/tokens.js.map +1 -0
  25. package/build/dex/aave-v3-stata/types.d.ts +46 -0
  26. package/build/dex/aave-v3-stata/types.js +23 -0
  27. package/build/dex/aave-v3-stata/types.js.map +1 -0
  28. package/build/dex/aave-v3-stata/utils.d.ts +4 -0
  29. package/build/dex/aave-v3-stata/utils.js +67 -0
  30. package/build/dex/aave-v3-stata/utils.js.map +1 -0
  31. package/build/dex/angle-transmuter/angle-transmuter-pool.d.ts +67 -0
  32. package/build/dex/angle-transmuter/angle-transmuter-pool.js +448 -0
  33. package/build/dex/angle-transmuter/angle-transmuter-pool.js.map +1 -0
  34. package/build/dex/angle-transmuter/angle-transmuter.d.ts +59 -0
  35. package/build/dex/angle-transmuter/angle-transmuter.js +264 -0
  36. package/build/dex/angle-transmuter/angle-transmuter.js.map +1 -0
  37. package/build/dex/angle-transmuter/backedOracle.d.ts +19 -0
  38. package/build/dex/angle-transmuter/backedOracle.js +56 -0
  39. package/build/dex/angle-transmuter/backedOracle.js.map +1 -0
  40. package/build/dex/angle-transmuter/config.d.ts +4 -0
  41. package/build/dex/angle-transmuter/config.js +50 -0
  42. package/build/dex/angle-transmuter/config.js.map +1 -0
  43. package/build/dex/angle-transmuter/constants.d.ts +9 -0
  44. package/build/dex/angle-transmuter/constants.js +136 -0
  45. package/build/dex/angle-transmuter/constants.js.map +1 -0
  46. package/build/dex/angle-transmuter/morphoOracle.d.ts +42 -0
  47. package/build/dex/angle-transmuter/morphoOracle.js +179 -0
  48. package/build/dex/angle-transmuter/morphoOracle.js.map +1 -0
  49. package/build/dex/angle-transmuter/morphoVault.d.ts +20 -0
  50. package/build/dex/angle-transmuter/morphoVault.js +84 -0
  51. package/build/dex/angle-transmuter/morphoVault.js.map +1 -0
  52. package/build/dex/angle-transmuter/pyth.d.ts +19 -0
  53. package/build/dex/angle-transmuter/pyth.js +70 -0
  54. package/build/dex/angle-transmuter/pyth.js.map +1 -0
  55. package/build/dex/angle-transmuter/redstone.d.ts +20 -0
  56. package/build/dex/angle-transmuter/redstone.js +64 -0
  57. package/build/dex/angle-transmuter/redstone.js.map +1 -0
  58. package/build/dex/angle-transmuter/transmuter.d.ts +55 -0
  59. package/build/dex/angle-transmuter/transmuter.js +398 -0
  60. package/build/dex/angle-transmuter/transmuter.js.map +1 -0
  61. package/build/dex/angle-transmuter/types.d.ts +189 -0
  62. package/build/dex/angle-transmuter/types.js +33 -0
  63. package/build/dex/angle-transmuter/types.js.map +1 -0
  64. package/build/dex/angle-transmuter/utils.d.ts +9 -0
  65. package/build/dex/angle-transmuter/utils.js +257 -0
  66. package/build/dex/angle-transmuter/utils.js.map +1 -0
  67. package/build/dex/idle-dao/config.d.ts +6 -0
  68. package/build/dex/idle-dao/config.js +307 -0
  69. package/build/dex/idle-dao/config.js.map +1 -0
  70. package/build/dex/idle-dao/idle-dao-pool.d.ts +56 -0
  71. package/build/dex/idle-dao/idle-dao-pool.js +176 -0
  72. package/build/dex/idle-dao/idle-dao-pool.js.map +1 -0
  73. package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +16 -0
  74. package/build/dex/idle-dao/idle-dao-pooling-pool.js +57 -0
  75. package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +1 -0
  76. package/build/dex/idle-dao/idle-dao.d.ts +41 -0
  77. package/build/dex/idle-dao/idle-dao.js +238 -0
  78. package/build/dex/idle-dao/idle-dao.js.map +1 -0
  79. package/build/dex/idle-dao/scripts.d.ts +9 -0
  80. package/build/dex/idle-dao/scripts.js +552 -0
  81. package/build/dex/idle-dao/scripts.js.map +1 -0
  82. package/build/dex/idle-dao/tokens.d.ts +9 -0
  83. package/build/dex/idle-dao/tokens.js +65 -0
  84. package/build/dex/idle-dao/tokens.js.map +1 -0
  85. package/build/dex/idle-dao/types.d.ts +35 -0
  86. package/build/dex/idle-dao/types.js +11 -0
  87. package/build/dex/idle-dao/types.js.map +1 -0
  88. package/build/dex/idle-dao/utils.d.ts +8 -0
  89. package/build/dex/idle-dao/utils.js +148 -0
  90. package/build/dex/idle-dao/utils.js.map +1 -0
  91. package/build/dex/index.js +4 -0
  92. package/build/dex/index.js.map +1 -1
  93. package/build/dex/platypus/platypus.d.ts +2 -1
  94. package/build/dex/platypus/platypus.js +31 -0
  95. package/build/dex/platypus/platypus.js.map +1 -1
  96. package/build/dex/swaap-v1/swaap-v1.d.ts +2 -1
  97. package/build/dex/swaap-v1/swaap-v1.js +10 -0
  98. package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
  99. package/build/lib/chainlink.d.ts +2 -0
  100. package/build/lib/chainlink.js +9 -0
  101. package/build/lib/chainlink.js.map +1 -1
  102. package/build/types.d.ts +1 -0
  103. package/build/utils.d.ts +1 -1
  104. package/package.json +1 -1
  105. package/src/abi/Redstone.json +739 -0
  106. package/src/abi/angle-transmuter/ChainlinkAccessControlledOffchainAggregator.json +1246 -0
  107. package/src/abi/angle-transmuter/ChainlinkEACAggregatorProxy.json +509 -0
  108. package/src/abi/angle-transmuter/MorphoOracle.json +193 -0
  109. package/src/abi/angle-transmuter/MorphoVault.json +2506 -0
  110. package/src/abi/angle-transmuter/Pyth.json +1534 -0
  111. package/src/abi/angle-transmuter/Transmuter.json +1711 -0
  112. package/src/abi/angle-transmuter/TransmuterSidechain.json +1798 -0
  113. package/src/abi/idle-dao/idle-cdo-factory.json +38 -0
  114. package/src/abi/idle-dao/idle-cdo.json +1245 -0
  115. package/src/config.ts +3 -0
  116. package/src/dex/angle-transmuter/angle-transmuter-e2e.test.ts +156 -0
  117. package/src/dex/angle-transmuter/angle-transmuter-events.test.ts +365 -0
  118. package/src/dex/angle-transmuter/angle-transmuter-integration.test.ts +390 -0
  119. package/src/dex/angle-transmuter/angle-transmuter-pool.ts +895 -0
  120. package/src/dex/angle-transmuter/angle-transmuter.ts +408 -0
  121. package/src/dex/angle-transmuter/backedOracle.ts +91 -0
  122. package/src/dex/angle-transmuter/config.ts +50 -0
  123. package/src/dex/angle-transmuter/constants.ts +138 -0
  124. package/src/dex/angle-transmuter/morphoOracle.ts +335 -0
  125. package/src/dex/angle-transmuter/morphoVault.ts +134 -0
  126. package/src/dex/angle-transmuter/pyth.ts +105 -0
  127. package/src/dex/angle-transmuter/redstone.ts +105 -0
  128. package/src/dex/angle-transmuter/transmuter.ts +619 -0
  129. package/src/dex/angle-transmuter/types.ts +203 -0
  130. package/src/dex/angle-transmuter/utils.ts +358 -0
  131. package/src/dex/idle-dao/config.ts +309 -0
  132. package/src/dex/idle-dao/idle-dao-e2e.test.ts +112 -0
  133. package/src/dex/idle-dao/idle-dao-integration.test.ts +155 -0
  134. package/src/dex/idle-dao/idle-dao.ts +363 -0
  135. package/src/dex/idle-dao/scripts.ts +553 -0
  136. package/src/dex/idle-dao/tokens.ts +90 -0
  137. package/src/dex/idle-dao/types.ts +43 -0
  138. package/src/dex/idle-dao/utils.ts +215 -0
  139. package/src/dex/index.ts +4 -0
  140. package/src/lib/chainlink.ts +15 -0
  141. package/src/types.ts +1 -0
  142. package/tests/constants-e2e.ts +117 -6
  143. package/build/abi/Uncompressor.json +0 -250
  144. package/build/dex/bProtocol.d.ts +0 -18
  145. package/build/dex/bProtocol.js +0 -39
  146. package/build/dex/bProtocol.js.map +0 -1
  147. package/build/dex/bancor.d.ts +0 -26
  148. package/build/dex/bancor.js +0 -58
  149. package/build/dex/bancor.js.map +0 -1
  150. package/build/dex/compound.d.ts +0 -18
  151. package/build/dex/compound.js +0 -46
  152. package/build/dex/compound.js.map +0 -1
  153. package/build/dex/curve-v2.d.ts +0 -58
  154. package/build/dex/curve-v2.js +0 -180
  155. package/build/dex/curve-v2.js.map +0 -1
  156. package/build/dex/dodo-v1.d.ts +0 -33
  157. package/build/dex/dodo-v1.js +0 -63
  158. package/build/dex/dodo-v1.js.map +0 -1
  159. package/build/dex/etherfi/etherfi.d.ts +0 -26
  160. package/build/dex/etherfi/etherfi.js +0 -96
  161. package/build/dex/etherfi/etherfi.js.map +0 -1
  162. package/build/dex/lido.d.ts +0 -19
  163. package/build/dex/lido.js +0 -42
  164. package/build/dex/lido.js.map +0 -1
  165. package/build/dex/onebit.d.ts +0 -25
  166. package/build/dex/onebit.js +0 -42
  167. package/build/dex/onebit.js.map +0 -1
  168. package/build/dex/sdai/config.d.ts +0 -11
  169. package/build/dex/sdai/config.js +0 -21
  170. package/build/dex/sdai/config.js.map +0 -1
  171. package/build/dex/sdai/constants.d.ts +0 -2
  172. package/build/dex/sdai/constants.js +0 -6
  173. package/build/dex/sdai/constants.js.map +0 -1
  174. package/build/dex/sdai/scripts/validate-state.d.ts +0 -1
  175. package/build/dex/sdai/scripts/validate-state.js +0 -102
  176. package/build/dex/sdai/scripts/validate-state.js.map +0 -1
  177. package/build/dex/sdai/sdai-pool.d.ts +0 -16
  178. package/build/dex/sdai/sdai-pool.js +0 -85
  179. package/build/dex/sdai/sdai-pool.js.map +0 -1
  180. package/build/dex/sdai/sdai.d.ts +0 -51
  181. package/build/dex/sdai/sdai.js +0 -172
  182. package/build/dex/sdai/sdai.js.map +0 -1
  183. package/build/dex/sdai/types.d.ts +0 -21
  184. package/build/dex/sdai/types.js +0 -11
  185. package/build/dex/sdai/types.js.map +0 -1
  186. package/build/dex/sdai/utils.d.ts +0 -4
  187. package/build/dex/sdai/utils.js +0 -39
  188. package/build/dex/sdai/utils.js.map +0 -1
  189. package/build/dex/smoothy.d.ts +0 -26
  190. package/build/dex/smoothy.js +0 -48
  191. package/build/dex/smoothy.js.map +0 -1
  192. package/build/dex/stable-pool.d.ts +0 -28
  193. package/build/dex/stable-pool.js +0 -62
  194. package/build/dex/stable-pool.js.map +0 -1
  195. package/build/dex/trader-joe-v2.1.d.ts +0 -43
  196. package/build/dex/trader-joe-v2.1.js +0 -79
  197. package/build/dex/trader-joe-v2.1.js.map +0 -1
  198. package/build/executor/compressor/Compressor.d.ts +0 -23
  199. package/build/executor/compressor/Compressor.js +0 -144
  200. package/build/executor/compressor/Compressor.js.map +0 -1
  201. package/build/executor/compressor/compress.d.ts +0 -17
  202. package/build/executor/compressor/compress.js +0 -187
  203. package/build/executor/compressor/compress.js.map +0 -1
  204. package/build/executor/compressor/compress_functions/addressSubstitution.d.ts +0 -6
  205. package/build/executor/compressor/compress_functions/addressSubstitution.js +0 -29
  206. package/build/executor/compressor/compress_functions/addressSubstitution.js.map +0 -1
  207. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.d.ts +0 -10
  208. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js +0 -40
  209. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js.map +0 -1
  210. package/build/executor/compressor/compress_functions/byteSubstitution.d.ts +0 -11
  211. package/build/executor/compressor/compress_functions/byteSubstitution.js +0 -64
  212. package/build/executor/compressor/compress_functions/byteSubstitution.js.map +0 -1
  213. package/build/executor/compressor/compress_functions/ffSubstitution.d.ts +0 -7
  214. package/build/executor/compressor/compress_functions/ffSubstitution.js +0 -54
  215. package/build/executor/compressor/compress_functions/ffSubstitution.js.map +0 -1
  216. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.d.ts +0 -8
  217. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js +0 -67
  218. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js.map +0 -1
  219. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.d.ts +0 -8
  220. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js +0 -61
  221. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js.map +0 -1
  222. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.d.ts +0 -6
  223. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js +0 -37
  224. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js.map +0 -1
  225. package/build/executor/compressor/compress_functions/searchUnusedBytes.d.ts +0 -9
  226. package/build/executor/compressor/compress_functions/searchUnusedBytes.js +0 -33
  227. package/build/executor/compressor/compress_functions/searchUnusedBytes.js.map +0 -1
  228. package/build/executor/compressor/fetchSaved.d.ts +0 -0
  229. package/build/executor/compressor/fetchSaved.js +0 -17
  230. package/build/executor/compressor/fetchSaved.js.map +0 -1
  231. package/build/executor/compressor/utils/computeCostL2.d.ts +0 -2
  232. package/build/executor/compressor/utils/computeCostL2.js +0 -14
  233. package/build/executor/compressor/utils/computeCostL2.js.map +0 -1
  234. package/build/executor/compressor/utils/findLongestDuplicatedString.d.ts +0 -2
  235. package/build/executor/compressor/utils/findLongestDuplicatedString.js +0 -30
  236. package/build/executor/compressor/utils/findLongestDuplicatedString.js.map +0 -1
  237. package/build/executor/compressor/utils/getAllIndexes.d.ts +0 -2
  238. package/build/executor/compressor/utils/getAllIndexes.js +0 -12
  239. package/build/executor/compressor/utils/getAllIndexes.js.map +0 -1
  240. package/build/executor/compressor/utils/getByteForAddress.d.ts +0 -2
  241. package/build/executor/compressor/utils/getByteForAddress.js +0 -14
  242. package/build/executor/compressor/utils/getByteForAddress.js.map +0 -1
  243. package/build/executor/compressor/utils/intTo2Bytes.d.ts +0 -2
  244. package/build/executor/compressor/utils/intTo2Bytes.js +0 -14
  245. package/build/executor/compressor/utils/intTo2Bytes.js.map +0 -1
  246. package/build/executor/compressor/utils/intTo3Bytes.d.ts +0 -2
  247. package/build/executor/compressor/utils/intTo3Bytes.js +0 -18
  248. package/build/executor/compressor/utils/intTo3Bytes.js.map +0 -1
  249. package/build/executor/compressor/utils/intToByte.d.ts +0 -2
  250. package/build/executor/compressor/utils/intToByte.js +0 -10
  251. package/build/executor/compressor/utils/intToByte.js.map +0 -1
@@ -0,0 +1,309 @@
1
+ import { DexParams, IdleToken } from './types';
2
+ import { DexConfigMap, AdapterMappings } from '../../types';
3
+ import { Network, SwapSide } from '../../constants';
4
+
5
+ export const Config: DexConfigMap<DexParams> = {
6
+ IdleDao: {
7
+ [Network.MAINNET]: {
8
+ lendingGasCost: 328 * 1000,
9
+ factoryAddress: '0x3c9916bb9498f637e2fa86c2028e26275dc9a631',
10
+ },
11
+ },
12
+ };
13
+
14
+ export const Adapters: Record<number, AdapterMappings> = {
15
+ [Network.MAINNET]: {
16
+ [SwapSide.SELL]: [{ name: '', index: 0 }],
17
+ [SwapSide.BUY]: [{ name: '', index: 0 }],
18
+ },
19
+ };
20
+
21
+ export const endpoints: Record<number, string> = {
22
+ [Network.MAINNET]: 'https://api.idle.finance/pools',
23
+ [Network.POLYGON]: 'https://api-polygon.idle.finance/pools',
24
+ [Network.OPTIMISM]: 'https://api-optimism.idle.finance/pools',
25
+ [Network.ZKEVM]: 'https://api-zkevm.idle.finance/pools',
26
+ };
27
+
28
+ export const TOKEN_LISTS: IdleToken[] = [
29
+ {
30
+ blockNumber: 0,
31
+ idleDecimals: 18,
32
+ cdoAddress: '0x34dCd573C5dE4672C8248cd12A99f875Ca112Ad8',
33
+ idleAddress: '0x2688fc68c4eac90d9e5e1b94776cf14eade8d877',
34
+ address: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
35
+ decimals: 18,
36
+ idleSymbol: 'AA_wstETH',
37
+ tokenType: 'AA',
38
+ },
39
+ {
40
+ blockNumber: 0,
41
+ idleDecimals: 18,
42
+ cdoAddress: '0x34dCd573C5dE4672C8248cd12A99f875Ca112Ad8',
43
+ idleAddress: '0x3a52fa30c33caf05faee0f9c5dfe5fd5fe8b3978',
44
+ address: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
45
+ decimals: 18,
46
+ idleSymbol: 'BB_wstETH',
47
+ tokenType: 'BB',
48
+ },
49
+ {
50
+ blockNumber: 0,
51
+ idleDecimals: 18,
52
+ cdoAddress: '0x8E0A8A5c1e5B3ac0670Ea5a613bB15724D51Fc37',
53
+ idleAddress: '0xdf17c739b666b259da3416d01f0310a6e429f592',
54
+ address: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
55
+ decimals: 18,
56
+ idleSymbol: 'AA_iETHv2',
57
+ tokenType: 'AA',
58
+ },
59
+ {
60
+ blockNumber: 0,
61
+ idleDecimals: 18,
62
+ cdoAddress: '0x8E0A8A5c1e5B3ac0670Ea5a613bB15724D51Fc37',
63
+ idleAddress: '0x990b3af34ddb502715e1070ce6778d8eb3c8ea82',
64
+ address: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
65
+ decimals: 18,
66
+ idleSymbol: 'BB_iETHv2',
67
+ tokenType: 'BB',
68
+ },
69
+ {
70
+ blockNumber: 0,
71
+ idleDecimals: 18,
72
+ cdoAddress: '0x1329E8DB9Ed7a44726572D44729427F132Fa290D',
73
+ idleAddress: '0x9cacd44cfdf22731bc99facf3531c809d56bd4a2',
74
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
75
+ decimals: 6,
76
+ idleSymbol: 'AA_idle_cpPOR-USDC',
77
+ tokenType: 'AA',
78
+ },
79
+ {
80
+ blockNumber: 0,
81
+ idleDecimals: 18,
82
+ cdoAddress: '0x1329E8DB9Ed7a44726572D44729427F132Fa290D',
83
+ idleAddress: '0xf85fd280b301c0a6232d515001da8b6c8503d714',
84
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
85
+ decimals: 6,
86
+ idleSymbol: 'BB_idle_cpPOR-USDC',
87
+ tokenType: 'BB',
88
+ },
89
+ {
90
+ blockNumber: 0,
91
+ idleDecimals: 18,
92
+ cdoAddress: '0xc4574C60a455655864aB80fa7638561A756C5E61',
93
+ idleAddress: '0x0a6f2449c09769950cfb76f905ad11c341541f70',
94
+ address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
95
+ decimals: 6,
96
+ idleSymbol: 'AA_idle_cpFAS-USDT',
97
+ tokenType: 'AA',
98
+ },
99
+ {
100
+ blockNumber: 0,
101
+ idleDecimals: 18,
102
+ cdoAddress: '0xc4574C60a455655864aB80fa7638561A756C5E61',
103
+ idleAddress: '0x3eb6318b8d9f362a0e1d99f6032edb1c4c602500',
104
+ address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
105
+ decimals: 6,
106
+ idleSymbol: 'BB_idle_cpFAS-USDT',
107
+ tokenType: 'BB',
108
+ },
109
+ {
110
+ blockNumber: 0,
111
+ idleDecimals: 18,
112
+ cdoAddress: '0xE7C6A4525492395d65e736C3593aC933F33ee46e',
113
+ idleAddress: '0xdca1dae87f5c733c84e0593984967ed756579bee',
114
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
115
+ decimals: 6,
116
+ idleSymbol: 'AA_idle_cpFASA-USDC',
117
+ tokenType: 'AA',
118
+ },
119
+ {
120
+ blockNumber: 0,
121
+ idleDecimals: 18,
122
+ cdoAddress: '0xE7C6A4525492395d65e736C3593aC933F33ee46e',
123
+ idleAddress: '0xbcc845bb731632ebe8ac0bfacde056170aaaaa06',
124
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
125
+ decimals: 6,
126
+ idleSymbol: 'BB_idle_cpFASA-USDC',
127
+ tokenType: 'BB',
128
+ },
129
+ {
130
+ blockNumber: 0,
131
+ idleDecimals: 18,
132
+ cdoAddress: '0x5dcA0B3Ed7594A6613c1A2acd367d56E1f74F92D',
133
+ idleAddress: '0x43ed68703006add5f99ce36b5182392362369c1c',
134
+ address: '0x6b175474e89094c44da98b954eedeac495271d0f',
135
+ decimals: 18,
136
+ idleSymbol: 'AA_idle_cpPOR-USDC',
137
+ tokenType: 'AA',
138
+ },
139
+ {
140
+ blockNumber: 0,
141
+ idleDecimals: 18,
142
+ cdoAddress: '0x5dcA0B3Ed7594A6613c1A2acd367d56E1f74F92D',
143
+ idleAddress: '0x38d36353d07cfb92650822d9c31fb4ada1c73d6e',
144
+ address: '0x6b175474e89094c44da98b954eedeac495271d0f',
145
+ decimals: 18,
146
+ idleSymbol: 'BB_idle_cpPOR-USDC',
147
+ tokenType: 'BB',
148
+ },
149
+ {
150
+ blockNumber: 0,
151
+ idleDecimals: 18,
152
+ cdoAddress: '0xF87ec7e1Ee467d7d78862089B92dd40497cBa5B8',
153
+ idleAddress: '0xaef4fcc4e5f2dc270760063446d4116d24704ad1',
154
+ address: '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0',
155
+ decimals: 18,
156
+ idleSymbol: 'AA_stMATIC',
157
+ tokenType: 'AA',
158
+ },
159
+ {
160
+ blockNumber: 0,
161
+ idleDecimals: 18,
162
+ cdoAddress: '0xF87ec7e1Ee467d7d78862089B92dd40497cBa5B8',
163
+ idleAddress: '0x077212c69a66261cf7bd1fd3b5c5db7cffa948ee',
164
+ address: '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0',
165
+ decimals: 18,
166
+ idleSymbol: 'BB_stMATIC',
167
+ tokenType: 'BB',
168
+ },
169
+ {
170
+ blockNumber: 0,
171
+ idleDecimals: 18,
172
+ cdoAddress: '0x87E53bE99975DA318056af5c4933469a6B513768',
173
+ idleAddress: '0x2b0e31b8ee653d2077db86dea3acf3f34ae9d5d2',
174
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
175
+ decimals: 6,
176
+ idleSymbol: 'AA_steakUSDC',
177
+ tokenType: 'AA',
178
+ },
179
+ {
180
+ blockNumber: 0,
181
+ idleDecimals: 18,
182
+ cdoAddress: '0x87E53bE99975DA318056af5c4933469a6B513768',
183
+ idleAddress: '0x7b713b1cb6eafd4061064581579ffccf7df21545',
184
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
185
+ decimals: 6,
186
+ idleSymbol: 'BB_steakUSDC',
187
+ tokenType: 'BB',
188
+ },
189
+ {
190
+ blockNumber: 0,
191
+ idleDecimals: 18,
192
+ cdoAddress: '0xA8d747Ef758469e05CF505D708b2514a1aB9Cc08',
193
+ idleAddress: '0x454bb3cb427b21e1c052a080e21a57753cd6969e',
194
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
195
+ decimals: 18,
196
+ idleSymbol: 'AA_Re7WETH',
197
+ tokenType: 'AA',
198
+ },
199
+ {
200
+ blockNumber: 0,
201
+ idleDecimals: 18,
202
+ cdoAddress: '0xA8d747Ef758469e05CF505D708b2514a1aB9Cc08',
203
+ idleAddress: '0x20aa3cd83044d2903181f7ef5c2b498a017d1c4a',
204
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
205
+ decimals: 18,
206
+ idleSymbol: 'BB_Re7WETH',
207
+ tokenType: 'BB',
208
+ },
209
+ {
210
+ blockNumber: 0,
211
+ idleDecimals: 18,
212
+ cdoAddress: '0xD071EA5D2575E155E4e9c2234968D1E11B8a920E',
213
+ idleAddress: '0xb9d321b26095195610707597aab416925c598aab',
214
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
215
+ decimals: 18,
216
+ idleSymbol: 'AA_Re7WETH',
217
+ tokenType: 'AA',
218
+ },
219
+ {
220
+ blockNumber: 0,
221
+ idleDecimals: 18,
222
+ cdoAddress: '0xD071EA5D2575E155E4e9c2234968D1E11B8a920E',
223
+ idleAddress: '0xf529f10fe24367d3a123faf0e9d5f6d80980b46f',
224
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
225
+ decimals: 18,
226
+ idleSymbol: 'BB_Re7WETH',
227
+ tokenType: 'BB',
228
+ },
229
+ {
230
+ blockNumber: 0,
231
+ idleDecimals: 18,
232
+ cdoAddress: '0x9e0c5ee5e4B187Cf18B23745FCF2b6aE66a9B52f',
233
+ idleAddress: '0x28d8a22c6689ac1e2ddc43ca6f85c520457351c1',
234
+ address: '0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
235
+ decimals: 18,
236
+ idleSymbol: 'AA_ampr-LP-ETH',
237
+ tokenType: 'AA',
238
+ },
239
+ {
240
+ blockNumber: 0,
241
+ idleDecimals: 18,
242
+ cdoAddress: '0x9e0c5ee5e4B187Cf18B23745FCF2b6aE66a9B52f',
243
+ idleAddress: '0xefc4f43737fd336fa8a8254454ced1e421804b16',
244
+ address: '0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
245
+ decimals: 18,
246
+ idleSymbol: 'BB_ampr-LP-ETH',
247
+ tokenType: 'BB',
248
+ },
249
+ {
250
+ blockNumber: 0,
251
+ idleDecimals: 18,
252
+ cdoAddress: '0x1EB1b47D0d8BCD9D761f52D26FCD90bBa225344C',
253
+ idleAddress: '0xf3188697bd35df73e4293d04a07ebaaf1ffc4018',
254
+ address: '0x4c9edd5852cd905f086c759e8383e09bff1e68b3',
255
+ decimals: 18,
256
+ idleSymbol: 'AA_sUSDe',
257
+ tokenType: 'AA',
258
+ },
259
+ {
260
+ blockNumber: 0,
261
+ idleDecimals: 18,
262
+ cdoAddress: '0x1EB1b47D0d8BCD9D761f52D26FCD90bBa225344C',
263
+ idleAddress: '0xb8d0be502a8f12cc5213733285b430a43d07349d',
264
+ address: '0x4c9edd5852cd905f086c759e8383e09bff1e68b3',
265
+ decimals: 18,
266
+ idleSymbol: 'BB_sUSDe',
267
+ tokenType: 'BB',
268
+ },
269
+ {
270
+ blockNumber: 0,
271
+ idleDecimals: 18,
272
+ cdoAddress: '0xbc48967C34d129a2ef25DD4dc693Cc7364d02eb9',
273
+ idleAddress: '0x0f09a04ad551dd941b589625bd2360fc962ff9f7',
274
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
275
+ decimals: 18,
276
+ idleSymbol: 'AA_dWETHV3',
277
+ tokenType: 'AA',
278
+ },
279
+ {
280
+ blockNumber: 0,
281
+ idleDecimals: 18,
282
+ cdoAddress: '0xbc48967C34d129a2ef25DD4dc693Cc7364d02eb9',
283
+ idleAddress: '0x1223ddeee77f8f379ea7a49e7650ff1ec1e2de8a',
284
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
285
+ decimals: 18,
286
+ idleSymbol: 'BB_dWETHV3',
287
+ tokenType: 'BB',
288
+ },
289
+ {
290
+ blockNumber: 0,
291
+ idleDecimals: 18,
292
+ cdoAddress: '0xdd4D030A4337CE492B55bc5169F6A9568242C0Bc',
293
+ idleAddress: '0x450c055a00226f1eba09e8d9627034565b7c4c8a',
294
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
295
+ decimals: 6,
296
+ idleSymbol: 'AA_dUSDCV3',
297
+ tokenType: 'AA',
298
+ },
299
+ {
300
+ blockNumber: 0,
301
+ idleDecimals: 18,
302
+ cdoAddress: '0xdd4D030A4337CE492B55bc5169F6A9568242C0Bc',
303
+ idleAddress: '0x2a84a042db06222c486bcb815e961f26599d0df6',
304
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
305
+ decimals: 6,
306
+ idleSymbol: 'BB_dUSDCV3',
307
+ tokenType: 'BB',
308
+ },
309
+ ];
@@ -0,0 +1,112 @@
1
+ /* eslint-disable no-console */
2
+ import dotenv from 'dotenv';
3
+ dotenv.config();
4
+
5
+ import { testE2E } from '../../../tests/utils-e2e';
6
+ import { Tokens, Holders } from '../../../tests/constants-e2e';
7
+ import { Network, ContractMethod, SwapSide } from '../../constants';
8
+ import { StaticJsonRpcProvider } from '@ethersproject/providers';
9
+ import { generateConfig } from '../../config';
10
+
11
+ function testForNetwork(
12
+ network: Network,
13
+ dexKey: string,
14
+ tokenASymbol: string,
15
+ tokenBSymbol: string,
16
+ tokenAAmount: string,
17
+ tokenBAmount: string,
18
+ ) {
19
+ const provider = new StaticJsonRpcProvider(
20
+ generateConfig(network).privateHttpProvider,
21
+ network,
22
+ );
23
+ const tokens = Tokens[network];
24
+ const holders = Holders[network];
25
+
26
+ const sideToContractMethods = new Map([
27
+ [SwapSide.SELL, [ContractMethod.swapExactAmountIn]],
28
+ // [SwapSide.BUY, [ContractMethod.swapExactAmountOut]],
29
+ ]);
30
+
31
+ describe(`${network}`, () => {
32
+ sideToContractMethods.forEach((contractMethods, side) =>
33
+ describe(`${side}`, () => {
34
+ contractMethods.forEach((contractMethod: ContractMethod) => {
35
+ describe(`${contractMethod}`, () => {
36
+ it(`${tokenASymbol} -> ${tokenBSymbol} - ${tokenAAmount}`, async () => {
37
+ await testE2E(
38
+ tokens[tokenASymbol],
39
+ tokens[tokenBSymbol],
40
+ holders[tokenASymbol],
41
+ side === SwapSide.SELL ? tokenAAmount : tokenBAmount,
42
+ side,
43
+ dexKey,
44
+ contractMethod,
45
+ network,
46
+ provider,
47
+ );
48
+ });
49
+ it(`${tokenBSymbol} -> ${tokenASymbol} - ${tokenBAmount}`, async () => {
50
+ await testE2E(
51
+ tokens[tokenBSymbol],
52
+ tokens[tokenASymbol],
53
+ holders[tokenBSymbol],
54
+ side === SwapSide.SELL ? tokenBAmount : tokenAAmount,
55
+ side,
56
+ dexKey,
57
+ contractMethod,
58
+ network,
59
+ provider,
60
+ );
61
+ });
62
+ });
63
+ });
64
+ }),
65
+ );
66
+ });
67
+ }
68
+
69
+ describe('IdleDao E2E', () => {
70
+ const dexKey = 'IdleDao';
71
+
72
+ describe('Mainnet', () => {
73
+ const network = Network.MAINNET;
74
+ const tests = [
75
+ {
76
+ tokenASymbol: 'STETH',
77
+ tokenBSymbol: 'AA_wstETH',
78
+ tokenAAmount: '1000000000000000000',
79
+ tokenBAmount: '1000000000000000000',
80
+ },
81
+ {
82
+ tokenASymbol: 'USDC',
83
+ tokenBSymbol: 'AA_idle_cpPOR-USDC',
84
+ tokenAAmount: '1000000',
85
+ tokenBAmount: '1000000000000000000',
86
+ },
87
+ {
88
+ tokenASymbol: 'USDT',
89
+ tokenBSymbol: 'BB_idle_cpFAS-USDT',
90
+ tokenAAmount: '1000000',
91
+ tokenBAmount: '1000000000000000000',
92
+ },
93
+ {
94
+ tokenASymbol: 'WETH',
95
+ tokenBSymbol: 'BB_Re7WETH',
96
+ tokenAAmount: '100000000000000',
97
+ tokenBAmount: '100000000000000',
98
+ },
99
+ ];
100
+
101
+ tests.forEach(testData => {
102
+ testForNetwork(
103
+ network,
104
+ dexKey,
105
+ testData.tokenASymbol,
106
+ testData.tokenBSymbol,
107
+ testData.tokenAAmount,
108
+ testData.tokenBAmount,
109
+ );
110
+ });
111
+ });
112
+ });
@@ -0,0 +1,155 @@
1
+ import dotenv from 'dotenv';
2
+ dotenv.config();
3
+
4
+ import { DummyDexHelper } from '../../dex-helper/index';
5
+ import { Network, SwapSide } from '../../constants';
6
+ import { IdleDao } from './idle-dao';
7
+ import { checkPoolPrices, checkPoolsLiquidity } from '../../../tests/utils';
8
+ import { Tokens } from '../../../tests/constants-e2e';
9
+
10
+ async function testForIntegration(
11
+ network: Network,
12
+ dexKey: string,
13
+ tokenASymbol: string,
14
+ tokenBSymbol: string,
15
+ tokenAAmount: string,
16
+ tokenBAmount: string,
17
+ ) {
18
+ const TokenA = Tokens[network][tokenASymbol];
19
+ const TokenB = Tokens[network][tokenBSymbol];
20
+ const tokenAAmounts = [
21
+ 0n,
22
+ BigInt(tokenAAmount),
23
+ BigInt(tokenAAmount) * BigInt(2),
24
+ ];
25
+ const tokenBAmounts = [
26
+ 0n,
27
+ BigInt(tokenBAmount),
28
+ BigInt(tokenBAmount) * BigInt(2),
29
+ ];
30
+
31
+ describe('IdleDao', function () {
32
+ it('getPoolIdentifiers and getPricesVolume SELL', async function () {
33
+ const dexHelper = new DummyDexHelper(network);
34
+ const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
35
+ const idleDao = new IdleDao(network, dexKey, dexHelper);
36
+
37
+ await idleDao.initializePricing(blocknumber);
38
+
39
+ const pools = await idleDao.getPoolIdentifiers(TokenA, TokenB);
40
+
41
+ expect(pools.length).toBeGreaterThan(0);
42
+
43
+ const poolPrices = await idleDao.getPricesVolume(
44
+ TokenA,
45
+ TokenB,
46
+ tokenAAmounts,
47
+ SwapSide.SELL,
48
+ blocknumber,
49
+ pools,
50
+ );
51
+
52
+ expect(poolPrices).not.toBeNull();
53
+ checkPoolPrices(poolPrices!, tokenAAmounts, SwapSide.SELL, dexKey);
54
+ });
55
+
56
+ it('getPoolIdentifiers and getPricesVolume BUY', async function () {
57
+ const dexHelper = new DummyDexHelper(network);
58
+ const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
59
+ const idleDao = new IdleDao(network, dexKey, dexHelper);
60
+
61
+ await idleDao.initializePricing(blocknumber);
62
+
63
+ const pools = await idleDao.getPoolIdentifiers(TokenA, TokenB);
64
+
65
+ expect(pools.length).toBeGreaterThan(0);
66
+
67
+ const poolPrices = await idleDao.getPricesVolume(
68
+ TokenA,
69
+ TokenB,
70
+ tokenBAmounts,
71
+ SwapSide.BUY,
72
+ blocknumber,
73
+ pools,
74
+ );
75
+
76
+ expect(poolPrices).not.toBeNull();
77
+ checkPoolPrices(poolPrices!, tokenBAmounts, SwapSide.BUY, dexKey);
78
+ });
79
+
80
+ it('getTopPoolsForToken', async function () {
81
+ const dexHelper = new DummyDexHelper(network);
82
+ const idleDao = new IdleDao(network, dexKey, dexHelper);
83
+
84
+ const poolLiquidity = await idleDao.getTopPoolsForToken(
85
+ TokenA.address,
86
+ 10,
87
+ );
88
+
89
+ checkPoolsLiquidity(poolLiquidity, TokenA.address, dexKey);
90
+ });
91
+ });
92
+ }
93
+
94
+ describe('IdleDao Integration tests', () => {
95
+ const dexKey = 'IdleDao';
96
+
97
+ describe('Mainnet', () => {
98
+ const network = Network.MAINNET;
99
+ const tests = [
100
+ {
101
+ tokenASymbol: 'STETH',
102
+ tokenBSymbol: 'AA_wstETH',
103
+ tokenAAmount: '1000000000000000000',
104
+ tokenBAmount: '1000000000000000000',
105
+ },
106
+ {
107
+ tokenASymbol: 'USDC',
108
+ tokenBSymbol: 'AA_idle_cpPOR-USDC',
109
+ tokenAAmount: '1000000',
110
+ tokenBAmount: '1000000000000000000',
111
+ },
112
+ {
113
+ tokenASymbol: 'USDT',
114
+ tokenBSymbol: 'BB_idle_cpFAS-USDT',
115
+ tokenAAmount: '1000000',
116
+ tokenBAmount: '1000000000000000000',
117
+ },
118
+ {
119
+ tokenASymbol: 'WETH',
120
+ tokenBSymbol: 'BB_Re7WETH',
121
+ tokenAAmount: '100000000000000',
122
+ tokenBAmount: '100000000000000',
123
+ },
124
+ {
125
+ tokenASymbol: 'WETH',
126
+ tokenBSymbol: 'AA_Re7WETH',
127
+ tokenAAmount: '1000000000000000',
128
+ tokenBAmount: '1000000000000000',
129
+ },
130
+ {
131
+ tokenASymbol: 'STETH',
132
+ tokenBSymbol: 'AA_iETHv2',
133
+ tokenAAmount: '1000000000000000',
134
+ tokenBAmount: '1000000000000000',
135
+ },
136
+ {
137
+ tokenASymbol: 'STETH',
138
+ tokenBSymbol: 'BB_iETHv2',
139
+ tokenAAmount: '1000000000000000',
140
+ tokenBAmount: '1000000000000000',
141
+ },
142
+ ];
143
+
144
+ tests.forEach(testData => {
145
+ testForIntegration(
146
+ network,
147
+ dexKey,
148
+ testData.tokenASymbol,
149
+ testData.tokenBSymbol,
150
+ testData.tokenAAmount,
151
+ testData.tokenBAmount,
152
+ );
153
+ });
154
+ });
155
+ });