@paraswap/dex-lib 3.7.2 → 3.7.3-idle.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 (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 +390 -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 +236 -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 +361 -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,553 @@
1
+ import { writeFileSync } from 'fs';
2
+
3
+ export const TOKEN_LISTS = [
4
+ {
5
+ decimals: 18,
6
+ blockNumber: 0,
7
+ cdoAddress: '0x34dCd573C5dE4672C8248cd12A99f875Ca112Ad8',
8
+ idleAddress: '0x2688fc68c4eac90d9e5e1b94776cf14eade8d877',
9
+ address: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
10
+ idleSymbol: 'AA_wstETH',
11
+ tokenType: 'AA',
12
+ },
13
+ {
14
+ decimals: 18,
15
+ blockNumber: 0,
16
+ cdoAddress: '0x34dCd573C5dE4672C8248cd12A99f875Ca112Ad8',
17
+ idleAddress: '0x3a52fa30c33caf05faee0f9c5dfe5fd5fe8b3978',
18
+ address: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
19
+ idleSymbol: 'BB_wstETH',
20
+ tokenType: 'BB',
21
+ },
22
+ {
23
+ decimals: 18,
24
+ blockNumber: 0,
25
+ cdoAddress: '0x8E0A8A5c1e5B3ac0670Ea5a613bB15724D51Fc37',
26
+ idleAddress: '0xdf17c739b666b259da3416d01f0310a6e429f592',
27
+ address: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
28
+ idleSymbol: 'AA_iETHv2',
29
+ tokenType: 'AA',
30
+ },
31
+ {
32
+ decimals: 18,
33
+ blockNumber: 0,
34
+ cdoAddress: '0x8E0A8A5c1e5B3ac0670Ea5a613bB15724D51Fc37',
35
+ idleAddress: '0x990b3af34ddb502715e1070ce6778d8eb3c8ea82',
36
+ address: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
37
+ idleSymbol: 'BB_iETHv2',
38
+ tokenType: 'BB',
39
+ },
40
+ {
41
+ decimals: 18,
42
+ blockNumber: 0,
43
+ cdoAddress: '0x1329E8DB9Ed7a44726572D44729427F132Fa290D',
44
+ idleAddress: '0x9cacd44cfdf22731bc99facf3531c809d56bd4a2',
45
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
46
+ idleSymbol: 'AA_idle_cpPOR-USDC',
47
+ tokenType: 'AA',
48
+ },
49
+ {
50
+ decimals: 18,
51
+ blockNumber: 0,
52
+ cdoAddress: '0x1329E8DB9Ed7a44726572D44729427F132Fa290D',
53
+ idleAddress: '0xf85fd280b301c0a6232d515001da8b6c8503d714',
54
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
55
+ idleSymbol: 'BB_idle_cpPOR-USDC',
56
+ tokenType: 'BB',
57
+ },
58
+ {
59
+ decimals: 18,
60
+ blockNumber: 0,
61
+ cdoAddress: '0xc4574C60a455655864aB80fa7638561A756C5E61',
62
+ idleAddress: '0x0a6f2449c09769950cfb76f905ad11c341541f70',
63
+ address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
64
+ idleSymbol: 'AA_idle_cpFAS-USDT',
65
+ tokenType: 'AA',
66
+ },
67
+ {
68
+ decimals: 18,
69
+ blockNumber: 0,
70
+ cdoAddress: '0xc4574C60a455655864aB80fa7638561A756C5E61',
71
+ idleAddress: '0x3eb6318b8d9f362a0e1d99f6032edb1c4c602500',
72
+ address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
73
+ idleSymbol: 'BB_idle_cpFAS-USDT',
74
+ tokenType: 'BB',
75
+ },
76
+ {
77
+ decimals: 18,
78
+ blockNumber: 0,
79
+ cdoAddress: '0xE7C6A4525492395d65e736C3593aC933F33ee46e',
80
+ idleAddress: '0xdca1dae87f5c733c84e0593984967ed756579bee',
81
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
82
+ idleSymbol: 'AA_idle_cpFASA-USDC',
83
+ tokenType: 'AA',
84
+ },
85
+ {
86
+ decimals: 18,
87
+ blockNumber: 0,
88
+ cdoAddress: '0xE7C6A4525492395d65e736C3593aC933F33ee46e',
89
+ idleAddress: '0xbcc845bb731632ebe8ac0bfacde056170aaaaa06',
90
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
91
+ idleSymbol: 'BB_idle_cpFASA-USDC',
92
+ tokenType: 'BB',
93
+ },
94
+ {
95
+ decimals: 18,
96
+ blockNumber: 0,
97
+ cdoAddress: '0x5dcA0B3Ed7594A6613c1A2acd367d56E1f74F92D',
98
+ idleAddress: '0x43ed68703006add5f99ce36b5182392362369c1c',
99
+ address: '0x6b175474e89094c44da98b954eedeac495271d0f',
100
+ idleSymbol: 'AA_idle_cpPOR-USDC',
101
+ tokenType: 'AA',
102
+ },
103
+ {
104
+ decimals: 18,
105
+ blockNumber: 0,
106
+ cdoAddress: '0x5dcA0B3Ed7594A6613c1A2acd367d56E1f74F92D',
107
+ idleAddress: '0x38d36353d07cfb92650822d9c31fb4ada1c73d6e',
108
+ address: '0x6b175474e89094c44da98b954eedeac495271d0f',
109
+ idleSymbol: 'BB_idle_cpPOR-USDC',
110
+ tokenType: 'BB',
111
+ },
112
+ {
113
+ decimals: 18,
114
+ blockNumber: 0,
115
+ cdoAddress: '0xF87ec7e1Ee467d7d78862089B92dd40497cBa5B8',
116
+ idleAddress: '0xaef4fcc4e5f2dc270760063446d4116d24704ad1',
117
+ address: '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0',
118
+ idleSymbol: 'AA_stMATIC',
119
+ tokenType: 'AA',
120
+ },
121
+ {
122
+ decimals: 18,
123
+ blockNumber: 0,
124
+ cdoAddress: '0xF87ec7e1Ee467d7d78862089B92dd40497cBa5B8',
125
+ idleAddress: '0x077212c69a66261cf7bd1fd3b5c5db7cffa948ee',
126
+ address: '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0',
127
+ idleSymbol: 'BB_stMATIC',
128
+ tokenType: 'BB',
129
+ },
130
+ {
131
+ decimals: 18,
132
+ blockNumber: 0,
133
+ cdoAddress: '0x260D1E0CB6CC9E34Ea18CE39bAB879d450Cdd706',
134
+ idleAddress: '0x10036c2e5c441cdef24a30134b6df5ebf116205e',
135
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
136
+ idleSymbol: 'AA_bbETH',
137
+ tokenType: 'AA',
138
+ },
139
+ {
140
+ decimals: 18,
141
+ blockNumber: 0,
142
+ cdoAddress: '0x260D1E0CB6CC9E34Ea18CE39bAB879d450Cdd706',
143
+ idleAddress: '0x3331b21abb39190a0426ca54d68f9e3e953eec8e',
144
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
145
+ idleSymbol: 'BB_bbETH',
146
+ tokenType: 'BB',
147
+ },
148
+ {
149
+ decimals: 18,
150
+ blockNumber: 0,
151
+ cdoAddress: '0x87E53bE99975DA318056af5c4933469a6B513768',
152
+ idleAddress: '0x2b0e31b8ee653d2077db86dea3acf3f34ae9d5d2',
153
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
154
+ idleSymbol: 'AA_steakUSDC',
155
+ tokenType: 'AA',
156
+ },
157
+ {
158
+ decimals: 18,
159
+ blockNumber: 0,
160
+ cdoAddress: '0x87E53bE99975DA318056af5c4933469a6B513768',
161
+ idleAddress: '0x7b713b1cb6eafd4061064581579ffccf7df21545',
162
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
163
+ idleSymbol: 'BB_steakUSDC',
164
+ tokenType: 'BB',
165
+ },
166
+ {
167
+ decimals: 18,
168
+ blockNumber: 0,
169
+ cdoAddress: '0xA8d747Ef758469e05CF505D708b2514a1aB9Cc08',
170
+ idleAddress: '0x454bb3cb427b21e1c052a080e21a57753cd6969e',
171
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
172
+ idleSymbol: 'AA_Re7WETH',
173
+ tokenType: 'AA',
174
+ },
175
+ {
176
+ decimals: 18,
177
+ blockNumber: 0,
178
+ cdoAddress: '0xA8d747Ef758469e05CF505D708b2514a1aB9Cc08',
179
+ idleAddress: '0x20aa3cd83044d2903181f7ef5c2b498a017d1c4a',
180
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
181
+ idleSymbol: 'BB_Re7WETH',
182
+ tokenType: 'BB',
183
+ },
184
+ {
185
+ decimals: 18,
186
+ blockNumber: 0,
187
+ cdoAddress: '0xD071EA5D2575E155E4e9c2234968D1E11B8a920E',
188
+ idleAddress: '0xb9d321b26095195610707597aab416925c598aab',
189
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
190
+ idleSymbol: 'AA_Re7WETH',
191
+ tokenType: 'AA',
192
+ },
193
+ {
194
+ decimals: 18,
195
+ blockNumber: 0,
196
+ cdoAddress: '0xD071EA5D2575E155E4e9c2234968D1E11B8a920E',
197
+ idleAddress: '0xf529f10fe24367d3a123faf0e9d5f6d80980b46f',
198
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
199
+ idleSymbol: 'BB_Re7WETH',
200
+ tokenType: 'BB',
201
+ },
202
+ {
203
+ decimals: 18,
204
+ blockNumber: 0,
205
+ cdoAddress: '0x9e0c5ee5e4B187Cf18B23745FCF2b6aE66a9B52f',
206
+ idleAddress: '0x28d8a22c6689ac1e2ddc43ca6f85c520457351c1',
207
+ address: '0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
208
+ idleSymbol: 'AA_ampr-LP-ETH',
209
+ tokenType: 'AA',
210
+ },
211
+ {
212
+ decimals: 18,
213
+ blockNumber: 0,
214
+ cdoAddress: '0x9e0c5ee5e4B187Cf18B23745FCF2b6aE66a9B52f',
215
+ idleAddress: '0xefc4f43737fd336fa8a8254454ced1e421804b16',
216
+ address: '0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
217
+ idleSymbol: 'BB_ampr-LP-ETH',
218
+ tokenType: 'BB',
219
+ },
220
+ {
221
+ decimals: 18,
222
+ blockNumber: 0,
223
+ cdoAddress: '0x1EB1b47D0d8BCD9D761f52D26FCD90bBa225344C',
224
+ idleAddress: '0xf3188697bd35df73e4293d04a07ebaaf1ffc4018',
225
+ address: '0x4c9edd5852cd905f086c759e8383e09bff1e68b3',
226
+ idleSymbol: 'AA_sUSDe',
227
+ tokenType: 'AA',
228
+ },
229
+ {
230
+ decimals: 18,
231
+ blockNumber: 0,
232
+ cdoAddress: '0x1EB1b47D0d8BCD9D761f52D26FCD90bBa225344C',
233
+ idleAddress: '0xb8d0be502a8f12cc5213733285b430a43d07349d',
234
+ address: '0x4c9edd5852cd905f086c759e8383e09bff1e68b3',
235
+ idleSymbol: 'BB_sUSDe',
236
+ tokenType: 'BB',
237
+ },
238
+ {
239
+ decimals: 18,
240
+ blockNumber: 0,
241
+ cdoAddress: '0xbc48967C34d129a2ef25DD4dc693Cc7364d02eb9',
242
+ idleAddress: '0x0f09a04ad551dd941b589625bd2360fc962ff9f7',
243
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
244
+ idleSymbol: 'AA_dWETHV3',
245
+ tokenType: 'AA',
246
+ },
247
+ {
248
+ decimals: 18,
249
+ blockNumber: 0,
250
+ cdoAddress: '0xbc48967C34d129a2ef25DD4dc693Cc7364d02eb9',
251
+ idleAddress: '0x1223ddeee77f8f379ea7a49e7650ff1ec1e2de8a',
252
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
253
+ idleSymbol: 'BB_dWETHV3',
254
+ tokenType: 'BB',
255
+ },
256
+ {
257
+ decimals: 18,
258
+ blockNumber: 0,
259
+ cdoAddress: '0xdd4D030A4337CE492B55bc5169F6A9568242C0Bc',
260
+ idleAddress: '0x450c055a00226f1eba09e8d9627034565b7c4c8a',
261
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
262
+ idleSymbol: 'AA_dUSDCV3',
263
+ tokenType: 'AA',
264
+ },
265
+ {
266
+ decimals: 18,
267
+ blockNumber: 0,
268
+ cdoAddress: '0xdd4D030A4337CE492B55bc5169F6A9568242C0Bc',
269
+ idleAddress: '0x2a84a042db06222c486bcb815e961f26599d0df6',
270
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
271
+ idleSymbol: 'BB_dUSDCV3',
272
+ tokenType: 'BB',
273
+ },
274
+ {
275
+ decimals: 18,
276
+ blockNumber: 0,
277
+ cdoAddress: '0x34dCd573C5dE4672C8248cd12A99f875Ca112Ad8',
278
+ idleAddress: '0x2688fc68c4eac90d9e5e1b94776cf14eade8d877',
279
+ address: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
280
+ idleSymbol: 'AA_wstETH',
281
+ tokenType: 'AA',
282
+ },
283
+ {
284
+ decimals: 18,
285
+ blockNumber: 0,
286
+ cdoAddress: '0x34dCd573C5dE4672C8248cd12A99f875Ca112Ad8',
287
+ idleAddress: '0x3a52fa30c33caf05faee0f9c5dfe5fd5fe8b3978',
288
+ address: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
289
+ idleSymbol: 'BB_wstETH',
290
+ tokenType: 'BB',
291
+ },
292
+ {
293
+ decimals: 18,
294
+ blockNumber: 0,
295
+ cdoAddress: '0x8E0A8A5c1e5B3ac0670Ea5a613bB15724D51Fc37',
296
+ idleAddress: '0xdf17c739b666b259da3416d01f0310a6e429f592',
297
+ address: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
298
+ idleSymbol: 'AA_iETHv2',
299
+ tokenType: 'AA',
300
+ },
301
+ {
302
+ decimals: 18,
303
+ blockNumber: 0,
304
+ cdoAddress: '0x8E0A8A5c1e5B3ac0670Ea5a613bB15724D51Fc37',
305
+ idleAddress: '0x990b3af34ddb502715e1070ce6778d8eb3c8ea82',
306
+ address: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
307
+ idleSymbol: 'BB_iETHv2',
308
+ tokenType: 'BB',
309
+ },
310
+ {
311
+ decimals: 18,
312
+ blockNumber: 0,
313
+ cdoAddress: '0x1329E8DB9Ed7a44726572D44729427F132Fa290D',
314
+ idleAddress: '0x9cacd44cfdf22731bc99facf3531c809d56bd4a2',
315
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
316
+ idleSymbol: 'AA_idle_cpPOR-USDC',
317
+ tokenType: 'AA',
318
+ },
319
+ {
320
+ decimals: 18,
321
+ blockNumber: 0,
322
+ cdoAddress: '0x1329E8DB9Ed7a44726572D44729427F132Fa290D',
323
+ idleAddress: '0xf85fd280b301c0a6232d515001da8b6c8503d714',
324
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
325
+ idleSymbol: 'BB_idle_cpPOR-USDC',
326
+ tokenType: 'BB',
327
+ },
328
+ {
329
+ decimals: 18,
330
+ blockNumber: 0,
331
+ cdoAddress: '0xc4574C60a455655864aB80fa7638561A756C5E61',
332
+ idleAddress: '0x0a6f2449c09769950cfb76f905ad11c341541f70',
333
+ address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
334
+ idleSymbol: 'AA_idle_cpFAS-USDT',
335
+ tokenType: 'AA',
336
+ },
337
+ {
338
+ decimals: 18,
339
+ blockNumber: 0,
340
+ cdoAddress: '0xc4574C60a455655864aB80fa7638561A756C5E61',
341
+ idleAddress: '0x3eb6318b8d9f362a0e1d99f6032edb1c4c602500',
342
+ address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
343
+ idleSymbol: 'BB_idle_cpFAS-USDT',
344
+ tokenType: 'BB',
345
+ },
346
+ {
347
+ decimals: 18,
348
+ blockNumber: 0,
349
+ cdoAddress: '0xE7C6A4525492395d65e736C3593aC933F33ee46e',
350
+ idleAddress: '0xdca1dae87f5c733c84e0593984967ed756579bee',
351
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
352
+ idleSymbol: 'AA_idle_cpFASA-USDC',
353
+ tokenType: 'AA',
354
+ },
355
+ {
356
+ decimals: 18,
357
+ blockNumber: 0,
358
+ cdoAddress: '0xE7C6A4525492395d65e736C3593aC933F33ee46e',
359
+ idleAddress: '0xbcc845bb731632ebe8ac0bfacde056170aaaaa06',
360
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
361
+ idleSymbol: 'BB_idle_cpFASA-USDC',
362
+ tokenType: 'BB',
363
+ },
364
+ {
365
+ decimals: 18,
366
+ blockNumber: 0,
367
+ cdoAddress: '0x5dcA0B3Ed7594A6613c1A2acd367d56E1f74F92D',
368
+ idleAddress: '0x43ed68703006add5f99ce36b5182392362369c1c',
369
+ address: '0x6b175474e89094c44da98b954eedeac495271d0f',
370
+ idleSymbol: 'AA_idle_cpPOR-USDC',
371
+ tokenType: 'AA',
372
+ },
373
+ {
374
+ decimals: 18,
375
+ blockNumber: 0,
376
+ cdoAddress: '0x5dcA0B3Ed7594A6613c1A2acd367d56E1f74F92D',
377
+ idleAddress: '0x38d36353d07cfb92650822d9c31fb4ada1c73d6e',
378
+ address: '0x6b175474e89094c44da98b954eedeac495271d0f',
379
+ idleSymbol: 'BB_idle_cpPOR-USDC',
380
+ tokenType: 'BB',
381
+ },
382
+ {
383
+ decimals: 18,
384
+ blockNumber: 0,
385
+ cdoAddress: '0xF87ec7e1Ee467d7d78862089B92dd40497cBa5B8',
386
+ idleAddress: '0xaef4fcc4e5f2dc270760063446d4116d24704ad1',
387
+ address: '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0',
388
+ idleSymbol: 'AA_stMATIC',
389
+ tokenType: 'AA',
390
+ },
391
+ {
392
+ decimals: 18,
393
+ blockNumber: 0,
394
+ cdoAddress: '0xF87ec7e1Ee467d7d78862089B92dd40497cBa5B8',
395
+ idleAddress: '0x077212c69a66261cf7bd1fd3b5c5db7cffa948ee',
396
+ address: '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0',
397
+ idleSymbol: 'BB_stMATIC',
398
+ tokenType: 'BB',
399
+ },
400
+ {
401
+ decimals: 18,
402
+ blockNumber: 0,
403
+ cdoAddress: '0x260D1E0CB6CC9E34Ea18CE39bAB879d450Cdd706',
404
+ idleAddress: '0x10036c2e5c441cdef24a30134b6df5ebf116205e',
405
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
406
+ idleSymbol: 'AA_bbETH',
407
+ tokenType: 'AA',
408
+ },
409
+ {
410
+ decimals: 18,
411
+ blockNumber: 0,
412
+ cdoAddress: '0x260D1E0CB6CC9E34Ea18CE39bAB879d450Cdd706',
413
+ idleAddress: '0x3331b21abb39190a0426ca54d68f9e3e953eec8e',
414
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
415
+ idleSymbol: 'BB_bbETH',
416
+ tokenType: 'BB',
417
+ },
418
+ {
419
+ decimals: 18,
420
+ blockNumber: 0,
421
+ cdoAddress: '0x87E53bE99975DA318056af5c4933469a6B513768',
422
+ idleAddress: '0x2b0e31b8ee653d2077db86dea3acf3f34ae9d5d2',
423
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
424
+ idleSymbol: 'AA_steakUSDC',
425
+ tokenType: 'AA',
426
+ },
427
+ {
428
+ decimals: 18,
429
+ blockNumber: 0,
430
+ cdoAddress: '0x87E53bE99975DA318056af5c4933469a6B513768',
431
+ idleAddress: '0x7b713b1cb6eafd4061064581579ffccf7df21545',
432
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
433
+ idleSymbol: 'BB_steakUSDC',
434
+ tokenType: 'BB',
435
+ },
436
+ {
437
+ decimals: 18,
438
+ blockNumber: 0,
439
+ cdoAddress: '0xA8d747Ef758469e05CF505D708b2514a1aB9Cc08',
440
+ idleAddress: '0x454bb3cb427b21e1c052a080e21a57753cd6969e',
441
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
442
+ idleSymbol: 'AA_Re7WETH',
443
+ tokenType: 'AA',
444
+ },
445
+ {
446
+ decimals: 18,
447
+ blockNumber: 0,
448
+ cdoAddress: '0xA8d747Ef758469e05CF505D708b2514a1aB9Cc08',
449
+ idleAddress: '0x20aa3cd83044d2903181f7ef5c2b498a017d1c4a',
450
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
451
+ idleSymbol: 'BB_Re7WETH',
452
+ tokenType: 'BB',
453
+ },
454
+ {
455
+ decimals: 18,
456
+ blockNumber: 0,
457
+ cdoAddress: '0xD071EA5D2575E155E4e9c2234968D1E11B8a920E',
458
+ idleAddress: '0xb9d321b26095195610707597aab416925c598aab',
459
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
460
+ idleSymbol: 'AA_Re7WETH',
461
+ tokenType: 'AA',
462
+ },
463
+ {
464
+ decimals: 18,
465
+ blockNumber: 0,
466
+ cdoAddress: '0xD071EA5D2575E155E4e9c2234968D1E11B8a920E',
467
+ idleAddress: '0xf529f10fe24367d3a123faf0e9d5f6d80980b46f',
468
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
469
+ idleSymbol: 'BB_Re7WETH',
470
+ tokenType: 'BB',
471
+ },
472
+ {
473
+ decimals: 18,
474
+ blockNumber: 0,
475
+ cdoAddress: '0x9e0c5ee5e4B187Cf18B23745FCF2b6aE66a9B52f',
476
+ idleAddress: '0x28d8a22c6689ac1e2ddc43ca6f85c520457351c1',
477
+ address: '0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
478
+ idleSymbol: 'AA_ampr-LP-ETH',
479
+ tokenType: 'AA',
480
+ },
481
+ {
482
+ decimals: 18,
483
+ blockNumber: 0,
484
+ cdoAddress: '0x9e0c5ee5e4B187Cf18B23745FCF2b6aE66a9B52f',
485
+ idleAddress: '0xefc4f43737fd336fa8a8254454ced1e421804b16',
486
+ address: '0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
487
+ idleSymbol: 'BB_ampr-LP-ETH',
488
+ tokenType: 'BB',
489
+ },
490
+ {
491
+ decimals: 18,
492
+ blockNumber: 0,
493
+ cdoAddress: '0x1EB1b47D0d8BCD9D761f52D26FCD90bBa225344C',
494
+ idleAddress: '0xf3188697bd35df73e4293d04a07ebaaf1ffc4018',
495
+ address: '0x4c9edd5852cd905f086c759e8383e09bff1e68b3',
496
+ idleSymbol: 'AA_sUSDe',
497
+ tokenType: 'AA',
498
+ },
499
+ {
500
+ decimals: 18,
501
+ blockNumber: 0,
502
+ cdoAddress: '0x1EB1b47D0d8BCD9D761f52D26FCD90bBa225344C',
503
+ idleAddress: '0xb8d0be502a8f12cc5213733285b430a43d07349d',
504
+ address: '0x4c9edd5852cd905f086c759e8383e09bff1e68b3',
505
+ idleSymbol: 'BB_sUSDe',
506
+ tokenType: 'BB',
507
+ },
508
+ {
509
+ decimals: 18,
510
+ blockNumber: 0,
511
+ cdoAddress: '0xbc48967C34d129a2ef25DD4dc693Cc7364d02eb9',
512
+ idleAddress: '0x0f09a04ad551dd941b589625bd2360fc962ff9f7',
513
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
514
+ idleSymbol: 'AA_dWETHV3',
515
+ tokenType: 'AA',
516
+ },
517
+ {
518
+ decimals: 18,
519
+ blockNumber: 0,
520
+ cdoAddress: '0xbc48967C34d129a2ef25DD4dc693Cc7364d02eb9',
521
+ idleAddress: '0x1223ddeee77f8f379ea7a49e7650ff1ec1e2de8a',
522
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
523
+ idleSymbol: 'BB_dWETHV3',
524
+ tokenType: 'BB',
525
+ },
526
+ {
527
+ decimals: 18,
528
+ blockNumber: 0,
529
+ cdoAddress: '0xdd4D030A4337CE492B55bc5169F6A9568242C0Bc',
530
+ idleAddress: '0x450c055a00226f1eba09e8d9627034565b7c4c8a',
531
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
532
+ idleSymbol: 'AA_dUSDCV3',
533
+ tokenType: 'AA',
534
+ },
535
+ {
536
+ decimals: 18,
537
+ blockNumber: 0,
538
+ cdoAddress: '0xdd4D030A4337CE492B55bc5169F6A9568242C0Bc',
539
+ idleAddress: '0x2a84a042db06222c486bcb815e961f26599d0df6',
540
+ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
541
+ idleSymbol: 'BB_dUSDCV3',
542
+ tokenType: 'BB',
543
+ },
544
+ ];
545
+
546
+ const unique = Array.from(
547
+ new Set(TOKEN_LISTS.map(el => JSON.stringify(el))),
548
+ ).map(el => JSON.parse(el));
549
+
550
+ // console.log(
551
+ // `Initial length: ${TOKEN_LISTS.length}, Unique length: ${unique.length}`,
552
+ // );
553
+ writeFileSync(__dirname + '/tokens.json', JSON.stringify(unique));
@@ -0,0 +1,90 @@
1
+ import { Token } from '../../types';
2
+ import { Network } from '../../constants';
3
+
4
+ import { IdleToken } from './types';
5
+ import { IDexHelper } from '../../dex-helper';
6
+ import CDO_ABI from '../../abi/idle-dao/idle-cdo.json';
7
+ import { AbiItem } from 'web3-utils';
8
+
9
+ const poolsByTokenAddress: { [address: string]: IdleToken[] } = {};
10
+
11
+ const TokensByAddress: { [network: number]: { [address: string]: IdleToken } } =
12
+ {};
13
+
14
+ export const getPoolsByTokenAddress = (address: string): IdleToken[] => {
15
+ return poolsByTokenAddress[address] || [];
16
+ };
17
+
18
+ // return null if the pair does not exists otherwise return the idleToken
19
+ export function getIdleTokenIfIdleDaoPair(
20
+ network: number,
21
+ src: Token,
22
+ dst: Token,
23
+ ): IdleToken | null {
24
+ const srcAddr = src.address.toLowerCase();
25
+ const dstAddr = dst.address.toLowerCase();
26
+
27
+ if (srcAddr === dstAddr) {
28
+ return null;
29
+ }
30
+
31
+ const _src = TokensByAddress[network][srcAddr];
32
+ const _dst = TokensByAddress[network][dstAddr];
33
+
34
+ if (_src && _src.address.toLowerCase() == dstAddr) {
35
+ return _src;
36
+ }
37
+
38
+ if (_dst && _dst.address.toLowerCase() == srcAddr) {
39
+ return _dst;
40
+ }
41
+
42
+ return null;
43
+ }
44
+
45
+ export function getTokenFromIdleToken(idleToken: IdleToken): Token {
46
+ return {
47
+ address: idleToken.idleAddress,
48
+ decimals: idleToken.idleDecimals,
49
+ symbol: idleToken.idleSymbol,
50
+ };
51
+ }
52
+
53
+ export function getIdleTokenByAddress(
54
+ network: Network,
55
+ address: string,
56
+ ): IdleToken | undefined {
57
+ return TokensByAddress[network]?.[address];
58
+ }
59
+
60
+ export function setTokensOnNetwork(
61
+ network: Network,
62
+ tokens: IdleToken[],
63
+ dexHelper: IDexHelper,
64
+ ): any {
65
+ for (let token of tokens) {
66
+ token.address = token.address.toLowerCase();
67
+ token.idleAddress = token.idleAddress.toLowerCase();
68
+
69
+ if (TokensByAddress[network] === undefined) {
70
+ TokensByAddress[network] = {};
71
+ }
72
+
73
+ if (poolsByTokenAddress[token.address] === undefined) {
74
+ poolsByTokenAddress[token.address] = [];
75
+ }
76
+
77
+ const tokenWithContract: IdleToken = {
78
+ ...token,
79
+ cdoContract: new dexHelper.web3Provider.eth.Contract(
80
+ CDO_ABI as AbiItem[],
81
+ token.cdoAddress,
82
+ ),
83
+ };
84
+ TokensByAddress[network][token.idleAddress] = tokenWithContract;
85
+ TokensByAddress[network][token.address] = tokenWithContract;
86
+ poolsByTokenAddress[token.address].push(token);
87
+ }
88
+
89
+ return TokensByAddress[network];
90
+ }
@@ -0,0 +1,43 @@
1
+ import { Address } from '@paraswap/core';
2
+ import { Contract } from 'web3-eth-contract';
3
+
4
+ export type DexParams = {
5
+ lendingGasCost: number;
6
+ factoryAddress: Address;
7
+ };
8
+
9
+ export type IdleToken = {
10
+ idleDecimals: number;
11
+ idleSymbol: string;
12
+ idleAddress: string;
13
+ cdoAddress: string;
14
+ cdoContract?: Contract; // used to get virtualPrice
15
+ tokenType: 'AA' | 'BB';
16
+ blockNumber: number;
17
+ address: string;
18
+ decimals: number;
19
+ };
20
+
21
+ export type TrancheToken = {
22
+ idleAddress: IdleToken['idleAddress'];
23
+ cdoAddress: IdleToken['cdoAddress'];
24
+ tokenType: IdleToken['tokenType'];
25
+ };
26
+
27
+ export type IdleDaoData = {
28
+ idleToken: Pick<IdleToken, 'cdoAddress' | 'tokenType'>;
29
+ fromIdleToken: boolean;
30
+ };
31
+
32
+ export type Deposit = [amount: string, referral?: string];
33
+
34
+ export type Withdraw = [amount: string];
35
+
36
+ export type Param = Deposit | Withdraw;
37
+
38
+ export enum PoolFunctions {
39
+ withdrawAA = 'withdrawAA',
40
+ depositAA = 'depositAARef',
41
+ withdrawBB = 'withdrawBB',
42
+ depositBB = 'depositBBRef',
43
+ }