@paraswap/dex-lib 3.8.14 → 3.8.15

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 (237) hide show
  1. package/.vscode/launch.json +6 -43
  2. package/.vscode/settings.json +2 -1
  3. package/build/abi/Uncompressor.json +250 -0
  4. package/build/abi/concentrator/arUSD.json +568 -0
  5. package/build/abi/concentrator/arUSD5115.json +1746 -0
  6. package/build/abi/fx-protocol/FxMarket.json +1284 -0
  7. package/build/abi/{wombat/pool.json → fx-protocol/FxUSD.json} +541 -603
  8. package/build/abi/fx-protocol/weETHOralce.json +676 -0
  9. package/build/abi/integral/factory.json +333 -0
  10. package/build/abi/integral/oracle.json +501 -0
  11. package/build/abi/integral/pool.json +1041 -0
  12. package/build/abi/integral/relayer.json +1536 -0
  13. package/build/abi/oswap/oswap.abi.json +452 -0
  14. package/build/dex/aave-v1/aave-v1.d.ts +1 -2
  15. package/build/dex/aave-v1/aave-v1.js +0 -23
  16. package/build/dex/aave-v1/aave-v1.js.map +1 -1
  17. package/build/dex/compound.js +1 -1
  18. package/build/dex/compound.js.map +1 -1
  19. package/build/dex/concentrator-arusd/concentrator-arusd-event.d.ts +17 -0
  20. package/build/dex/concentrator-arusd/concentrator-arusd-event.js +66 -0
  21. package/build/dex/concentrator-arusd/concentrator-arusd-event.js.map +1 -0
  22. package/build/dex/concentrator-arusd/concentrator-arusd.d.ts +41 -0
  23. package/build/dex/concentrator-arusd/concentrator-arusd.js +188 -0
  24. package/build/dex/concentrator-arusd/concentrator-arusd.js.map +1 -0
  25. package/build/dex/concentrator-arusd/config.d.ts +3 -0
  26. package/build/dex/concentrator-arusd/config.js +14 -0
  27. package/build/dex/concentrator-arusd/config.js.map +1 -0
  28. package/build/dex/concentrator-arusd/types.d.ts +14 -0
  29. package/build/dex/concentrator-arusd/types.js +3 -0
  30. package/build/dex/concentrator-arusd/types.js.map +1 -0
  31. package/build/dex/concentrator-arusd/utils.d.ts +4 -0
  32. package/build/dex/concentrator-arusd/utils.js +27 -0
  33. package/build/dex/concentrator-arusd/utils.js.map +1 -0
  34. package/build/dex/etherfi/etherfi.d.ts +26 -0
  35. package/build/dex/etherfi/etherfi.js +96 -0
  36. package/build/dex/etherfi/etherfi.js.map +1 -0
  37. package/build/dex/fx-protocol-rusd/config.d.ts +3 -0
  38. package/build/dex/fx-protocol-rusd/config.js +15 -0
  39. package/build/dex/fx-protocol-rusd/config.js.map +1 -0
  40. package/build/dex/fx-protocol-rusd/fx-protocol-rusd-event.d.ts +18 -0
  41. package/build/dex/fx-protocol-rusd/fx-protocol-rusd-event.js +71 -0
  42. package/build/dex/fx-protocol-rusd/fx-protocol-rusd-event.js.map +1 -0
  43. package/build/dex/fx-protocol-rusd/fx-protocol-rusd.d.ts +39 -0
  44. package/build/dex/fx-protocol-rusd/fx-protocol-rusd.js +201 -0
  45. package/build/dex/fx-protocol-rusd/fx-protocol-rusd.js.map +1 -0
  46. package/build/dex/fx-protocol-rusd/types.d.ts +13 -0
  47. package/build/dex/fx-protocol-rusd/types.js +3 -0
  48. package/build/dex/fx-protocol-rusd/types.js.map +1 -0
  49. package/build/dex/fx-protocol-rusd/utils.d.ts +4 -0
  50. package/build/dex/fx-protocol-rusd/utils.js +26 -0
  51. package/build/dex/fx-protocol-rusd/utils.js.map +1 -0
  52. package/build/dex/index.js +4 -0
  53. package/build/dex/index.js.map +1 -1
  54. package/build/dex/integral/config.d.ts +4 -0
  55. package/build/dex/integral/config.js +20 -0
  56. package/build/dex/integral/config.js.map +1 -0
  57. package/build/dex/integral/context.d.ts +40 -0
  58. package/build/dex/integral/context.js +158 -0
  59. package/build/dex/integral/context.js.map +1 -0
  60. package/build/dex/integral/helpers.d.ts +17 -0
  61. package/build/dex/integral/helpers.js +157 -0
  62. package/build/dex/integral/helpers.js.map +1 -0
  63. package/build/dex/integral/integral-factory.d.ts +24 -0
  64. package/build/dex/integral/integral-factory.js +95 -0
  65. package/build/dex/integral/integral-factory.js.map +1 -0
  66. package/build/dex/integral/integral-pool.d.ts +50 -0
  67. package/build/dex/integral/integral-pool.js +149 -0
  68. package/build/dex/integral/integral-pool.js.map +1 -0
  69. package/build/dex/integral/integral-pricing.d.ts +18 -0
  70. package/build/dex/integral/integral-pricing.js +114 -0
  71. package/build/dex/integral/integral-pricing.js.map +1 -0
  72. package/build/dex/integral/integral-relayer.d.ts +42 -0
  73. package/build/dex/integral/integral-relayer.js +192 -0
  74. package/build/dex/integral/integral-relayer.js.map +1 -0
  75. package/build/dex/integral/integral-token.d.ts +27 -0
  76. package/build/dex/integral/integral-token.js +59 -0
  77. package/build/dex/integral/integral-token.js.map +1 -0
  78. package/build/dex/integral/integral.d.ts +41 -0
  79. package/build/dex/integral/integral.js +377 -0
  80. package/build/dex/integral/integral.js.map +1 -0
  81. package/build/dex/integral/types.d.ts +84 -0
  82. package/build/dex/integral/types.js +9 -0
  83. package/build/dex/integral/types.js.map +1 -0
  84. package/build/dex/integral/utils-e2e.d.ts +9 -0
  85. package/build/dex/integral/utils-e2e.js +131 -0
  86. package/build/dex/integral/utils-e2e.js.map +1 -0
  87. package/build/dex/integral/utils.d.ts +17 -0
  88. package/build/dex/integral/utils.js +94 -0
  89. package/build/dex/integral/utils.js.map +1 -0
  90. package/build/dex/oswap/config.d.ts +5 -0
  91. package/build/dex/oswap/config.js +31 -0
  92. package/build/dex/oswap/config.js.map +1 -0
  93. package/build/dex/oswap/oswap-pool.d.ts +51 -0
  94. package/build/dex/oswap/oswap-pool.js +150 -0
  95. package/build/dex/oswap/oswap-pool.js.map +1 -0
  96. package/build/dex/oswap/oswap.d.ts +46 -0
  97. package/build/dex/oswap/oswap.js +266 -0
  98. package/build/dex/oswap/oswap.js.map +1 -0
  99. package/build/dex/oswap/types.d.ts +20 -0
  100. package/build/dex/oswap/types.js +3 -0
  101. package/build/dex/oswap/types.js.map +1 -0
  102. package/build/dex/platypus/platypus.d.ts +1 -2
  103. package/build/dex/platypus/platypus.js +0 -45
  104. package/build/dex/platypus/platypus.js.map +1 -1
  105. package/build/dex/sdai/config.d.ts +11 -0
  106. package/build/dex/sdai/config.js +21 -0
  107. package/build/dex/sdai/config.js.map +1 -0
  108. package/build/dex/sdai/constants.d.ts +2 -0
  109. package/build/dex/sdai/constants.js +6 -0
  110. package/build/dex/sdai/constants.js.map +1 -0
  111. package/build/dex/sdai/scripts/validate-state.js +102 -0
  112. package/build/dex/sdai/scripts/validate-state.js.map +1 -0
  113. package/build/dex/sdai/sdai-pool.d.ts +16 -0
  114. package/build/dex/sdai/sdai-pool.js +85 -0
  115. package/build/dex/sdai/sdai-pool.js.map +1 -0
  116. package/build/dex/sdai/sdai.d.ts +51 -0
  117. package/build/dex/sdai/sdai.js +172 -0
  118. package/build/dex/sdai/sdai.js.map +1 -0
  119. package/build/dex/sdai/types.d.ts +21 -0
  120. package/build/dex/sdai/types.js +11 -0
  121. package/build/dex/sdai/types.js.map +1 -0
  122. package/build/dex/sdai/utils.d.ts +4 -0
  123. package/build/dex/sdai/utils.js +39 -0
  124. package/build/dex/sdai/utils.js.map +1 -0
  125. package/build/dex/stable-pool.js +8 -1
  126. package/build/dex/stable-pool.js.map +1 -1
  127. package/build/dex/swaap-v1/swaap-v1.d.ts +1 -2
  128. package/build/dex/swaap-v1/swaap-v1.js +0 -14
  129. package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
  130. package/build/executor/compressor/Compressor.d.ts +23 -0
  131. package/build/executor/compressor/Compressor.js +144 -0
  132. package/build/executor/compressor/Compressor.js.map +1 -0
  133. package/build/executor/compressor/compress.d.ts +17 -0
  134. package/build/executor/compressor/compress.js +187 -0
  135. package/build/executor/compressor/compress.js.map +1 -0
  136. package/build/executor/compressor/compress_functions/addressSubstitution.d.ts +6 -0
  137. package/build/executor/compressor/compress_functions/addressSubstitution.js +29 -0
  138. package/build/executor/compressor/compress_functions/addressSubstitution.js.map +1 -0
  139. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.d.ts +10 -0
  140. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js +40 -0
  141. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js.map +1 -0
  142. package/build/executor/compressor/compress_functions/byteSubstitution.d.ts +11 -0
  143. package/build/executor/compressor/compress_functions/byteSubstitution.js +64 -0
  144. package/build/executor/compressor/compress_functions/byteSubstitution.js.map +1 -0
  145. package/build/executor/compressor/compress_functions/ffSubstitution.d.ts +7 -0
  146. package/build/executor/compressor/compress_functions/ffSubstitution.js +54 -0
  147. package/build/executor/compressor/compress_functions/ffSubstitution.js.map +1 -0
  148. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.d.ts +8 -0
  149. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js +67 -0
  150. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js.map +1 -0
  151. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.d.ts +8 -0
  152. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js +61 -0
  153. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js.map +1 -0
  154. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.d.ts +6 -0
  155. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js +37 -0
  156. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js.map +1 -0
  157. package/build/executor/compressor/compress_functions/searchUnusedBytes.d.ts +9 -0
  158. package/build/executor/compressor/compress_functions/searchUnusedBytes.js +33 -0
  159. package/build/executor/compressor/compress_functions/searchUnusedBytes.js.map +1 -0
  160. package/build/executor/compressor/fetchSaved.js +17 -0
  161. package/build/executor/compressor/fetchSaved.js.map +1 -0
  162. package/build/executor/compressor/utils/computeCostL2.d.ts +2 -0
  163. package/build/executor/compressor/utils/computeCostL2.js +14 -0
  164. package/build/executor/compressor/utils/computeCostL2.js.map +1 -0
  165. package/build/executor/compressor/utils/findLongestDuplicatedString.d.ts +2 -0
  166. package/build/executor/compressor/utils/findLongestDuplicatedString.js +30 -0
  167. package/build/executor/compressor/utils/findLongestDuplicatedString.js.map +1 -0
  168. package/build/executor/compressor/utils/getAllIndexes.d.ts +2 -0
  169. package/build/executor/compressor/utils/getAllIndexes.js +12 -0
  170. package/build/executor/compressor/utils/getAllIndexes.js.map +1 -0
  171. package/build/executor/compressor/utils/getByteForAddress.d.ts +2 -0
  172. package/build/executor/compressor/utils/getByteForAddress.js +14 -0
  173. package/build/executor/compressor/utils/getByteForAddress.js.map +1 -0
  174. package/build/executor/compressor/utils/intTo2Bytes.d.ts +2 -0
  175. package/build/executor/compressor/utils/intTo2Bytes.js +14 -0
  176. package/build/executor/compressor/utils/intTo2Bytes.js.map +1 -0
  177. package/build/executor/compressor/utils/intTo3Bytes.d.ts +2 -0
  178. package/build/executor/compressor/utils/intTo3Bytes.js +18 -0
  179. package/build/executor/compressor/utils/intTo3Bytes.js.map +1 -0
  180. package/build/executor/compressor/utils/intToByte.d.ts +2 -0
  181. package/build/executor/compressor/utils/intToByte.js +10 -0
  182. package/build/executor/compressor/utils/intToByte.js.map +1 -0
  183. package/package.json +1 -1
  184. package/src/abi/concentrator/arUSD.json +568 -0
  185. package/src/abi/concentrator/arUSD5115.json +1746 -0
  186. package/src/abi/fx-protocol/FxMarket.json +1284 -0
  187. package/src/abi/fx-protocol/FxUSD.json +1227 -0
  188. package/src/abi/fx-protocol/weETHOralce.json +676 -0
  189. package/src/dex/concentrator-arusd/concentrator-arusd-e2e.test.ts +92 -0
  190. package/src/dex/concentrator-arusd/concentrator-arusd-event.ts +100 -0
  191. package/src/dex/concentrator-arusd/concentrator-arusd-integration.test.ts +104 -0
  192. package/src/dex/concentrator-arusd/concentrator-arusd.ts +269 -0
  193. package/src/dex/concentrator-arusd/concetrator-arusd-events.test.ts +97 -0
  194. package/src/dex/concentrator-arusd/config.ts +13 -0
  195. package/src/dex/concentrator-arusd/types.ts +16 -0
  196. package/src/dex/concentrator-arusd/utils.ts +36 -0
  197. package/src/dex/fx-protocol-rusd/config.ts +14 -0
  198. package/src/dex/fx-protocol-rusd/fx-protocol-e2e.test.ts +96 -0
  199. package/src/dex/fx-protocol-rusd/fx-protocol-events.test.ts +101 -0
  200. package/src/dex/fx-protocol-rusd/fx-protocol-integration.test.ts +104 -0
  201. package/src/dex/fx-protocol-rusd/fx-protocol-rusd-event.ts +112 -0
  202. package/src/dex/fx-protocol-rusd/fx-protocol-rusd.ts +282 -0
  203. package/src/dex/fx-protocol-rusd/types.ts +16 -0
  204. package/src/dex/fx-protocol-rusd/utils.ts +47 -0
  205. package/src/dex/index.ts +4 -0
  206. package/src/dex/wsteth/wsteth-integration.test.ts +0 -1
  207. package/tests/constants-e2e.ts +10 -0
  208. package/.vscode/tasks.json +0 -15
  209. package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +0 -52
  210. package/build/dex/aave-v2/tokens-avalanche.json +0 -44
  211. package/build/dex/aave-v2/tokens-mainnet.json +0 -188
  212. package/build/dex/aave-v2/tokens-polygon.json +0 -44
  213. package/build/dex/maker-psm/scripts/gem.abi.json +0 -136
  214. package/build/dex/maker-psm/scripts/validate-state.js +0 -185
  215. package/build/dex/maker-psm/scripts/validate-state.js.map +0 -1
  216. package/build/dex/maker-psm/scripts/vat.abi.json +0 -243
  217. package/build/dex/solidly-v3/scripts/check-event-pool-event.js +0 -53
  218. package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +0 -1
  219. package/build/dex/trader-joe-v2.1/base.d.ts +0 -18
  220. package/build/dex/trader-joe-v2.1/base.js +0 -99
  221. package/build/dex/trader-joe-v2.1/base.js.map +0 -1
  222. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +0 -7
  223. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +0 -20
  224. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +0 -1
  225. package/build/dex/trader-joe-v2.1/trader-joe-v2.2.d.ts +0 -7
  226. package/build/dex/trader-joe-v2.1/trader-joe-v2.2.js +0 -20
  227. package/build/dex/trader-joe-v2.1/trader-joe-v2.2.js.map +0 -1
  228. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +0 -17
  229. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +0 -64
  230. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +0 -1
  231. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +0 -17
  232. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +0 -79
  233. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +0 -1
  234. package/config.ts +0 -1946
  235. package/src/dex/dexs.txt +0 -58
  236. /package/build/dex/{solidly-v3/scripts/check-event-pool-event.d.ts → sdai/scripts/validate-state.d.ts} +0 -0
  237. /package/build/{dex/maker-psm/scripts/validate-state.d.ts → executor/compressor/fetchSaved.d.ts} +0 -0
@@ -0,0 +1,452 @@
1
+ [
2
+ {
3
+ "inputs": [],
4
+ "stateMutability": "nonpayable",
5
+ "type": "constructor"
6
+ },
7
+ {
8
+ "anonymous": false,
9
+ "inputs": [
10
+ {
11
+ "indexed": false,
12
+ "internalType": "address",
13
+ "name": "previousAdmin",
14
+ "type": "address"
15
+ },
16
+ {
17
+ "indexed": false,
18
+ "internalType": "address",
19
+ "name": "newAdmin",
20
+ "type": "address"
21
+ }
22
+ ],
23
+ "name": "AdminChanged",
24
+ "type": "event"
25
+ },
26
+ {
27
+ "anonymous": false,
28
+ "inputs": [
29
+ {
30
+ "indexed": false,
31
+ "internalType": "address",
32
+ "name": "previousAdmin",
33
+ "type": "address"
34
+ },
35
+ {
36
+ "indexed": false,
37
+ "internalType": "address",
38
+ "name": "newAdmin",
39
+ "type": "address"
40
+ }
41
+ ],
42
+ "name": "OperatorChanged",
43
+ "type": "event"
44
+ },
45
+ {
46
+ "anonymous": false,
47
+ "inputs": [
48
+ {
49
+ "indexed": false,
50
+ "internalType": "uint256",
51
+ "name": "traderate0",
52
+ "type": "uint256"
53
+ },
54
+ {
55
+ "indexed": false,
56
+ "internalType": "uint256",
57
+ "name": "traderate1",
58
+ "type": "uint256"
59
+ }
60
+ ],
61
+ "name": "TraderateChanged",
62
+ "type": "event"
63
+ },
64
+ {
65
+ "inputs": [],
66
+ "name": "approveStETH",
67
+ "outputs": [],
68
+ "stateMutability": "nonpayable",
69
+ "type": "function"
70
+ },
71
+ {
72
+ "inputs": [
73
+ {
74
+ "internalType": "uint256[]",
75
+ "name": "requestIds",
76
+ "type": "uint256[]"
77
+ }
78
+ ],
79
+ "name": "claimStETHWithdrawalForETH",
80
+ "outputs": [],
81
+ "stateMutability": "nonpayable",
82
+ "type": "function"
83
+ },
84
+ {
85
+ "inputs": [
86
+ {
87
+ "internalType": "uint256[]",
88
+ "name": "requestIds",
89
+ "type": "uint256[]"
90
+ }
91
+ ],
92
+ "name": "claimStETHWithdrawalForWETH",
93
+ "outputs": [],
94
+ "stateMutability": "nonpayable",
95
+ "type": "function"
96
+ },
97
+ {
98
+ "inputs": [
99
+ {
100
+ "internalType": "uint256",
101
+ "name": "amount",
102
+ "type": "uint256"
103
+ }
104
+ ],
105
+ "name": "depositETHForStETH",
106
+ "outputs": [],
107
+ "stateMutability": "nonpayable",
108
+ "type": "function"
109
+ },
110
+ {
111
+ "inputs": [
112
+ {
113
+ "internalType": "uint256",
114
+ "name": "amount",
115
+ "type": "uint256"
116
+ }
117
+ ],
118
+ "name": "depositWETHForStETH",
119
+ "outputs": [],
120
+ "stateMutability": "nonpayable",
121
+ "type": "function"
122
+ },
123
+ {
124
+ "inputs": [],
125
+ "name": "minimumFunds",
126
+ "outputs": [
127
+ {
128
+ "internalType": "uint256",
129
+ "name": "",
130
+ "type": "uint256"
131
+ }
132
+ ],
133
+ "stateMutability": "view",
134
+ "type": "function"
135
+ },
136
+ {
137
+ "inputs": [],
138
+ "name": "operator",
139
+ "outputs": [
140
+ {
141
+ "internalType": "address",
142
+ "name": "",
143
+ "type": "address"
144
+ }
145
+ ],
146
+ "stateMutability": "view",
147
+ "type": "function"
148
+ },
149
+ {
150
+ "inputs": [],
151
+ "name": "owner",
152
+ "outputs": [
153
+ {
154
+ "internalType": "address",
155
+ "name": "",
156
+ "type": "address"
157
+ }
158
+ ],
159
+ "stateMutability": "view",
160
+ "type": "function"
161
+ },
162
+ {
163
+ "inputs": [
164
+ {
165
+ "internalType": "uint256[]",
166
+ "name": "amounts",
167
+ "type": "uint256[]"
168
+ }
169
+ ],
170
+ "name": "requestStETHWithdrawalForETH",
171
+ "outputs": [
172
+ {
173
+ "internalType": "uint256[]",
174
+ "name": "requestIds",
175
+ "type": "uint256[]"
176
+ }
177
+ ],
178
+ "stateMutability": "nonpayable",
179
+ "type": "function"
180
+ },
181
+ {
182
+ "inputs": [
183
+ {
184
+ "internalType": "uint256",
185
+ "name": "_minimumFunds",
186
+ "type": "uint256"
187
+ }
188
+ ],
189
+ "name": "setMinimumFunds",
190
+ "outputs": [],
191
+ "stateMutability": "nonpayable",
192
+ "type": "function"
193
+ },
194
+ {
195
+ "inputs": [
196
+ {
197
+ "internalType": "address",
198
+ "name": "newOperator",
199
+ "type": "address"
200
+ }
201
+ ],
202
+ "name": "setOperator",
203
+ "outputs": [],
204
+ "stateMutability": "nonpayable",
205
+ "type": "function"
206
+ },
207
+ {
208
+ "inputs": [
209
+ {
210
+ "internalType": "address",
211
+ "name": "newOwner",
212
+ "type": "address"
213
+ }
214
+ ],
215
+ "name": "setOwner",
216
+ "outputs": [],
217
+ "stateMutability": "nonpayable",
218
+ "type": "function"
219
+ },
220
+ {
221
+ "inputs": [
222
+ {
223
+ "internalType": "uint256",
224
+ "name": "buyT1",
225
+ "type": "uint256"
226
+ },
227
+ {
228
+ "internalType": "uint256",
229
+ "name": "sellT1",
230
+ "type": "uint256"
231
+ }
232
+ ],
233
+ "name": "setPrices",
234
+ "outputs": [],
235
+ "stateMutability": "nonpayable",
236
+ "type": "function"
237
+ },
238
+ {
239
+ "inputs": [],
240
+ "name": "steth",
241
+ "outputs": [
242
+ {
243
+ "internalType": "contract IERC20",
244
+ "name": "",
245
+ "type": "address"
246
+ }
247
+ ],
248
+ "stateMutability": "view",
249
+ "type": "function"
250
+ },
251
+ {
252
+ "inputs": [
253
+ {
254
+ "internalType": "uint256",
255
+ "name": "amountIn",
256
+ "type": "uint256"
257
+ },
258
+ {
259
+ "internalType": "uint256",
260
+ "name": "amountOutMin",
261
+ "type": "uint256"
262
+ },
263
+ {
264
+ "internalType": "address[]",
265
+ "name": "path",
266
+ "type": "address[]"
267
+ },
268
+ {
269
+ "internalType": "address",
270
+ "name": "to",
271
+ "type": "address"
272
+ },
273
+ {
274
+ "internalType": "uint256",
275
+ "name": "deadline",
276
+ "type": "uint256"
277
+ }
278
+ ],
279
+ "name": "swapExactTokensForTokens",
280
+ "outputs": [
281
+ {
282
+ "internalType": "uint256[]",
283
+ "name": "amounts",
284
+ "type": "uint256[]"
285
+ }
286
+ ],
287
+ "stateMutability": "nonpayable",
288
+ "type": "function"
289
+ },
290
+ {
291
+ "inputs": [
292
+ {
293
+ "internalType": "uint256",
294
+ "name": "amountOut",
295
+ "type": "uint256"
296
+ },
297
+ {
298
+ "internalType": "uint256",
299
+ "name": "amountInMax",
300
+ "type": "uint256"
301
+ },
302
+ {
303
+ "internalType": "address[]",
304
+ "name": "path",
305
+ "type": "address[]"
306
+ },
307
+ {
308
+ "internalType": "address",
309
+ "name": "to",
310
+ "type": "address"
311
+ },
312
+ {
313
+ "internalType": "uint256",
314
+ "name": "deadline",
315
+ "type": "uint256"
316
+ }
317
+ ],
318
+ "name": "swapTokensForExactTokens",
319
+ "outputs": [
320
+ {
321
+ "internalType": "uint256[]",
322
+ "name": "amounts",
323
+ "type": "uint256[]"
324
+ }
325
+ ],
326
+ "stateMutability": "nonpayable",
327
+ "type": "function"
328
+ },
329
+ {
330
+ "inputs": [],
331
+ "name": "token0",
332
+ "outputs": [
333
+ {
334
+ "internalType": "contract IERC20",
335
+ "name": "",
336
+ "type": "address"
337
+ }
338
+ ],
339
+ "stateMutability": "view",
340
+ "type": "function"
341
+ },
342
+ {
343
+ "inputs": [],
344
+ "name": "token1",
345
+ "outputs": [
346
+ {
347
+ "internalType": "contract IERC20",
348
+ "name": "",
349
+ "type": "address"
350
+ }
351
+ ],
352
+ "stateMutability": "view",
353
+ "type": "function"
354
+ },
355
+ {
356
+ "inputs": [],
357
+ "name": "traderate0",
358
+ "outputs": [
359
+ {
360
+ "internalType": "uint256",
361
+ "name": "",
362
+ "type": "uint256"
363
+ }
364
+ ],
365
+ "stateMutability": "view",
366
+ "type": "function"
367
+ },
368
+ {
369
+ "inputs": [],
370
+ "name": "traderate1",
371
+ "outputs": [
372
+ {
373
+ "internalType": "uint256",
374
+ "name": "",
375
+ "type": "uint256"
376
+ }
377
+ ],
378
+ "stateMutability": "view",
379
+ "type": "function"
380
+ },
381
+ {
382
+ "inputs": [
383
+ {
384
+ "internalType": "address",
385
+ "name": "to",
386
+ "type": "address"
387
+ },
388
+ {
389
+ "internalType": "uint256",
390
+ "name": "amount",
391
+ "type": "uint256"
392
+ }
393
+ ],
394
+ "name": "transferEth",
395
+ "outputs": [],
396
+ "stateMutability": "nonpayable",
397
+ "type": "function"
398
+ },
399
+ {
400
+ "inputs": [
401
+ {
402
+ "internalType": "address",
403
+ "name": "token",
404
+ "type": "address"
405
+ },
406
+ {
407
+ "internalType": "address",
408
+ "name": "to",
409
+ "type": "address"
410
+ },
411
+ {
412
+ "internalType": "uint256",
413
+ "name": "amount",
414
+ "type": "uint256"
415
+ }
416
+ ],
417
+ "name": "transferToken",
418
+ "outputs": [],
419
+ "stateMutability": "nonpayable",
420
+ "type": "function"
421
+ },
422
+ {
423
+ "inputs": [],
424
+ "name": "weth",
425
+ "outputs": [
426
+ {
427
+ "internalType": "contract IWEth",
428
+ "name": "",
429
+ "type": "address"
430
+ }
431
+ ],
432
+ "stateMutability": "view",
433
+ "type": "function"
434
+ },
435
+ {
436
+ "inputs": [],
437
+ "name": "withdrawal",
438
+ "outputs": [
439
+ {
440
+ "internalType": "contract IStETHWithdrawal",
441
+ "name": "",
442
+ "type": "address"
443
+ }
444
+ ],
445
+ "stateMutability": "view",
446
+ "type": "function"
447
+ },
448
+ {
449
+ "stateMutability": "payable",
450
+ "type": "receive"
451
+ }
452
+ ]
@@ -1,5 +1,5 @@
1
1
  import { Interface } from '@ethersproject/abi';
2
- import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, SimpleExchangeParam, PoolLiquidity, Logger, NumberAsString, DexExchangeParam } from '../../types';
2
+ import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, SimpleExchangeParam, PoolLiquidity, Logger } from '../../types';
3
3
  import { SwapSide, Network } from '../../constants';
4
4
  import { IDex } from '../../dex/idex';
5
5
  import { IDexHelper } from '../../dex-helper/idex-helper';
@@ -28,7 +28,6 @@ export declare class AaveV1 extends SimpleExchange implements IDex<AaveV1Data, A
28
28
  getCalldataGasCost(poolPrices: PoolPrices<AaveV1Data>): number | number[];
29
29
  getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: AaveV1Data, side: SwapSide): AdapterExchangeParam;
30
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
31
  updatePoolState(): Promise<void>;
33
32
  getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
34
33
  }
@@ -139,29 +139,6 @@ class AaveV1 extends simple_exchange_1.SimpleExchange {
139
139
  const swapData = Interface.encodeFunctionData(swapFunction, swapFunctionParams);
140
140
  return this.buildSimpleParamWithoutWETHConversion(srcToken, amount, destToken, destAmount, swapData, swapCallee, spender);
141
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
- returnAmountPos: undefined,
163
- };
164
- }
165
142
  // This is called once before getTopPoolsForToken is
166
143
  // called for multiple tokens. This can be helpful to
167
144
  // update common state required for calculating
@@ -1 +1 @@
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,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ACrB,KAAa;QAEb,OAAO,EAAE,CAAC;IACZ,CAAC;;AApLH,wBAqLC;AA9Ke,yBAAkB,GAC9B,IAAA,6BAAqB,EAAC,qBAAY,CAAC,CAAC"}
@@ -38,7 +38,7 @@ class Compound extends simple_exchange_1.SimpleExchange {
38
38
  const swapData = (0, utils_1.isETHAddress)(srcToken)
39
39
  ? this.cethInterface.encodeFunctionData(CompoundFunctions.mint)
40
40
  : this.erc20Interface.encodeFunctionData(data.fromCToken ? CompoundFunctions.redeem : CompoundFunctions.mint, [srcAmount]);
41
- return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, cToken);
41
+ return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, cToken, undefined, undefined, undefined, data.fromCToken);
42
42
  }
43
43
  }
44
44
  exports.Compound = Compound;
@@ -1 +1 @@
1
- {"version":3,"file":"compound.js","sourceRoot":"","sources":["../../src/dex/compound.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA6D;AAC7D,4CAAsD;AAGtD,uDAAmD;AACnD,mFAA6C,CAAC,WAAW;AACzD,oCAAwC;AAQxC,IAAK,iBAGJ;AAHD,WAAK,iBAAiB;IACpB,sCAAiB,CAAA;IACjB,kCAAa,CAAA;AACf,CAAC,EAHI,iBAAiB,KAAjB,iBAAiB,QAGrB;AAED,MAAa,QACX,SAAQ,gCAAc;IAMtB,YAAY,SAAqB;QAC/B,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,IAAI,eAAS,CAAC,4BAAsB,CAAC,CAAC;IAC7D,CAAC;IAED,eAAe,CACb,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,UAAkB,EAClB,IAAkB,EAClB,IAAc;QAEd,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU;QAEjE,MAAM,O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/C,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,SAAS,EACT,SAAS,EACT,SAAS,EACT,IAAI,CAAC,UAAU,CAChB,CAAC;IACJ,CAAC;;AAnEH,4BAoEC;AAhEQ,gBAAO,GAAG,CAAC,UAAU,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { Interface } from '@ethersproject/abi';
2
+ import { IDexHelper } from '../../dex-helper';
3
+ import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
4
+ import { Address, Log, Logger } from '../../types';
5
+ import { AsyncOrSync, DeepReadonly } from 'ts-essentials';
6
+ import { ConcentratorArusdState } from './types';
7
+ export declare class ConcentratorArusdEvent extends StatefulEventSubscriber<ConcentratorArusdState> {
8
+ protected dexHelper: IDexHelper;
9
+ private poolAddress;
10
+ private poolInterface;
11
+ decoder: (log: Log) => import("@ethersproject/abi").LogDescription;
12
+ constructor(parentName: string, dexHelper: IDexHelper, poolAddress: Address, poolInterface: Interface, logger: Logger);
13
+ protected processLog(state: DeepReadonly<ConcentratorArusdState>, log: Readonly<Log>): AsyncOrSync<DeepReadonly<ConcentratorArusdState> | null>;
14
+ generateState(blockNumber?: number | 'latest'): Promise<DeepReadonly<ConcentratorArusdState>>;
15
+ getPrice(blockNumber: number, ethAmount: bigint, is_deposit: boolean): Promise<bigint>;
16
+ getOrGenerateState(blockNumber: number): Promise<DeepReadonly<ConcentratorArusdState> | null>;
17
+ }
@@ -0,0 +1,66 @@
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.ConcentratorArusdEvent = void 0;
7
+ const lodash_1 = __importDefault(require("lodash"));
8
+ const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
9
+ const bigint_constants_1 = require("../../bigint-constants");
10
+ const utils_1 = require("./utils");
11
+ class ConcentratorArusdEvent extends stateful_event_subscriber_1.StatefulEventSubscriber {
12
+ constructor(parentName, dexHelper, poolAddress, poolInterface, logger) {
13
+ super(parentName, 'ConcentratorArusd', dexHelper, logger);
14
+ this.dexHelper = dexHelper;
15
+ this.poolAddress = poolAddress;
16
+ this.poolInterface = poolInterface;
17
+ this.decoder = (log) => this.poolInterface.parseLog(log);
18
+ this.addressesSubscribed = [poolAddress];
19
+ }
20
+ processLog(state, log) {
21
+ const event = this.decoder(log);
22
+ const _state = lodash_1.default.cloneDeep(state);
23
+ if (event.name === 'Deposit') {
24
+ _state.totalSupply = (BigInt(_state.totalSupply) + BigInt(event.args.amountSyOut)).toString();
25
+ _state.totalAssets = (BigInt(_state.totalAssets) + BigInt(event.args.amountDeposited)).toString();
26
+ return _state;
27
+ }
28
+ else if (event.name === 'Redeem') {
29
+ _state.totalSupply = (BigInt(_state.totalSupply) - BigInt(event.args.amountSyToRedeem)).toString();
30
+ _state.totalAssets = (BigInt(_state.totalAssets) - BigInt(event.args.amountTokenOut)).toString();
31
+ return _state;
32
+ }
33
+ return null;
34
+ }
35
+ async generateState(blockNumber = 'latest') {
36
+ const state = await (0, utils_1.getOnChainState)(this.dexHelper.multiContract, this.poolAddress, this.poolInterface, blockNumber);
37
+ return state;
38
+ }
39
+ async getPrice(blockNumber, ethAmount, is_deposit) {
40
+ const state = await this.getOrGenerateState(blockNumber);
41
+ if (!state)
42
+ throw new Error('Cannot compute price');
43
+ const { totalSupply, totalAssets } = state;
44
+ const nav = (BigInt(totalAssets) * bigint_constants_1.BI_POWS[18]) / BigInt(totalSupply);
45
+ if (is_deposit) {
46
+ return BigInt((ethAmount * bigint_constants_1.BI_POWS[18]) / nav);
47
+ }
48
+ return BigInt((nav * ethAmount) / bigint_constants_1.BI_POWS[18]);
49
+ }
50
+ async getOrGenerateState(blockNumber) {
51
+ const state = this.getState(blockNumber);
52
+ if (state) {
53
+ return state;
54
+ }
55
+ this.logger.debug(`No state found for ${this.addressesSubscribed[0]}, generating new one`);
56
+ const newState = await this.generateState(blockNumber);
57
+ if (!newState) {
58
+ this.logger.debug(`Could not regenerate state for ${this.addressesSubscribed[0]}`);
59
+ return null;
60
+ }
61
+ this.setState(newState, blockNumber);
62
+ return newState;
63
+ }
64
+ }
65
+ exports.ConcentratorArusdEvent = ConcentratorArusdEvent;
66
+ //# sourceMappingURL=concentrator-arusd-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concentrator-arusd-event.js","sourceRoot":"","sources":["../../../src/dex/concentrator-arusd/concentrator-arusd-event.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAGvB,+EAA0E;AAI1E,6DAAiD;AACjD,mCAA0C;AAE1C,MAAa,sBAAuB,SAAQ,mDAA+C;IAGzF,YACE,UAAkB,EACR,SAAqB,EACvB,WAAoB,EACpB,aAAwB,EAChC,MAAc;QAEd,KAAK,CAAC,UAAU,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QALhD,cAAS,GAAT,SAAS,CAAY;QACvB,gBAAW,GAAX,WAAW,CAAS;QACpB,kBAAa,GAAb,aAAa,CAAW;QANlC,YAAO,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAUvD,IAAI,CAAC,mBAAmB,GAAG,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC;IAES,UAAU,CAClB,KAA2C,EAC3C,GAAkB;QAElB,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChC,MAAM,MAAM,GAA2B,gBAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC1D,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE;YAC5B,MAAM,CAAC,WAAW,GAAG,CACnB,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAC5D,CAAC,QAAQ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AAM,CAAC,WAAW,CAAC,CAAC;QACtE,IAAI,UAAU,EAAE;YACd,OAAO,MAAM,CAAC,CAAC,SAAS,GAAG,0BAAO,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;SAChD;QACD,OAAO,MAAM,CAAC,CAAC,GAAG,GAAG,SAAS,CAAC,GAAG,0BAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,kBAAkB,CACtB,WAAmB;QAEnB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACzC,IAAI,KAAK,EAAE;YACT,OAAO,KAAK,CAAC;SACd;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,sBAAsB,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,sBAAsB,CACxE,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QAEvD,IAAI,CAAC,QAAQ,EAAE;YACb,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,kCAAkC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAChE,CAAC;YACF,OAAO,IAAI,CAAC;SACb;QACD,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACrC,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAzFD,wDAyFC"}
@@ -0,0 +1,41 @@
1
+ import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, PoolLiquidity, Logger, NumberAsString, DexExchangeParam } from '../../types';
2
+ import { SwapSide, Network } from '../../constants';
3
+ import { Context, IDex } from '../../dex/idex';
4
+ import { IDexHelper } from '../../dex-helper/idex-helper';
5
+ import { ConcentratorArusdData, DexParams } from './types';
6
+ import { SimpleExchange } from '../simple-exchange';
7
+ import { Interface } from '@ethersproject/abi';
8
+ import { ConcentratorArusdEvent } from './concentrator-arusd-event';
9
+ export declare class ConcentratorArusd extends SimpleExchange implements IDex<ConcentratorArusdData> {
10
+ readonly network: Network;
11
+ readonly dexKey: string;
12
+ readonly dexHelper: IDexHelper;
13
+ protected adapters: {};
14
+ static readonly arUSDIface: Interface;
15
+ protected config: DexParams;
16
+ readonly hasConstantPriceLargeAmounts = true;
17
+ readonly needWrapNative = true;
18
+ readonly isFeeOnTransferSupported = false;
19
+ static dexKeysWithNetwork: {
20
+ key: string;
21
+ networks: Network[];
22
+ }[];
23
+ arUSD5115Iface: Interface;
24
+ concentratorArusdEvent: ConcentratorArusdEvent;
25
+ logger: Logger;
26
+ constructor(network: Network, dexKey: string, dexHelper: IDexHelper, adapters?: {});
27
+ initializePricing(blockNumber: number): Promise<void>;
28
+ is_arUSD(token: string): boolean;
29
+ is_rUSD(token: string): boolean;
30
+ is_arUSD_swap_token(srcToken: string, destToken: string): boolean;
31
+ getAdapters(side: SwapSide): {
32
+ name: string;
33
+ index: number;
34
+ }[] | null;
35
+ getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
36
+ getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<ConcentratorArusdData>>;
37
+ getCalldataGasCost(poolPrices: PoolPrices<ConcentratorArusdData>): number | number[];
38
+ getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: ConcentratorArusdData, side: SwapSide): AdapterExchangeParam;
39
+ getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: ConcentratorArusdData, side: SwapSide, context: Context, executorAddress: Address): Promise<DexExchangeParam>;
40
+ getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
41
+ }