@paraswap/dex-lib 3.8.15 → 3.8.16-oswap

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 (240) hide show
  1. package/build/abi/{integral/pool.json → inception/inception-ineth-pool.json} +558 -537
  2. package/build/abi/inception/inception-ineth.json +609 -0
  3. package/build/abi/inception/inception-ratio-feed.json +93 -0
  4. package/build/abi/inception/inception-vault.json +991 -0
  5. package/build/abi/infusion/InfusionFactory.json +147 -0
  6. package/build/abi/infusion/InfusionPair.json +658 -0
  7. package/build/abi/infusion/InfusionRouter.json +442 -0
  8. package/build/dex/aave-v1/aave-v1.d.ts +2 -1
  9. package/build/dex/aave-v1/aave-v1.js +22 -0
  10. package/build/dex/aave-v1/aave-v1.js.map +1 -1
  11. package/build/dex/angle-transmuter/angle-transmuter.js +1 -1
  12. package/build/dex/angle-transmuter/angle-transmuter.js.map +1 -1
  13. package/build/dex/idex.d.ts +11 -7
  14. package/build/dex/idle-dao/idle-dao-pool.d.ts +56 -0
  15. package/build/dex/idle-dao/idle-dao-pool.js +176 -0
  16. package/build/dex/idle-dao/idle-dao-pool.js.map +1 -0
  17. package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +16 -0
  18. package/build/dex/idle-dao/idle-dao-pooling-pool.js +57 -0
  19. package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +1 -0
  20. package/build/dex/idle-dao/scripts.d.ts +9 -0
  21. package/build/dex/idle-dao/scripts.js +552 -0
  22. package/build/dex/idle-dao/scripts.js.map +1 -0
  23. package/build/dex/inception/config.d.ts +5 -0
  24. package/build/dex/inception/config.js +112 -0
  25. package/build/dex/inception/config.js.map +1 -0
  26. package/build/dex/inception/inception-event-pool.d.ts +23 -0
  27. package/build/dex/inception/inception-event-pool.js +34 -0
  28. package/build/dex/inception/inception-event-pool.js.map +1 -0
  29. package/build/dex/{integral/integral.d.ts → inception/inception-native.d.ts} +21 -19
  30. package/build/dex/inception/inception-native.js +131 -0
  31. package/build/dex/inception/inception-native.js.map +1 -0
  32. package/build/dex/inception/inception-pool.d.ts +18 -0
  33. package/build/dex/inception/inception-pool.js +32 -0
  34. package/build/dex/inception/inception-pool.js.map +1 -0
  35. package/build/dex/inception/inception-price-feed.d.ts +19 -0
  36. package/build/dex/inception/inception-price-feed.js +51 -0
  37. package/build/dex/inception/inception-price-feed.js.map +1 -0
  38. package/build/dex/inception/inception.d.ts +44 -0
  39. package/build/dex/inception/inception.js +162 -0
  40. package/build/dex/inception/inception.js.map +1 -0
  41. package/build/dex/inception/tokens.d.ts +9 -0
  42. package/build/dex/inception/tokens.js +28 -0
  43. package/build/dex/inception/tokens.js.map +1 -0
  44. package/build/dex/inception/types.d.ts +22 -0
  45. package/build/dex/inception/types.js +3 -0
  46. package/build/dex/inception/types.js.map +1 -0
  47. package/build/dex/inception/utils.d.ts +7 -0
  48. package/build/dex/inception/utils.js +58 -0
  49. package/build/dex/inception/utils.js.map +1 -0
  50. package/build/dex/index.js +2 -0
  51. package/build/dex/index.js.map +1 -1
  52. package/build/dex/{integral → infusion}/config.d.ts +1 -1
  53. package/build/dex/infusion/config.js +25 -0
  54. package/build/dex/infusion/config.js.map +1 -0
  55. package/build/dex/infusion/infusion-stable-pool.d.ts +4 -0
  56. package/build/dex/infusion/infusion-stable-pool.js +74 -0
  57. package/build/dex/infusion/infusion-stable-pool.js.map +1 -0
  58. package/build/dex/infusion/infusion.d.ts +54 -0
  59. package/build/dex/infusion/infusion.js +510 -0
  60. package/build/dex/infusion/infusion.js.map +1 -0
  61. package/build/dex/infusion/types.d.ts +47 -0
  62. package/build/dex/infusion/types.js +3 -0
  63. package/build/dex/infusion/types.js.map +1 -0
  64. package/build/dex/infusion/utils/isStablePair.d.ts +2 -0
  65. package/build/dex/infusion/utils/isStablePair.js +18 -0
  66. package/build/dex/infusion/utils/isStablePair.js.map +1 -0
  67. package/build/dex/oswap/oswap.d.ts +2 -2
  68. package/build/dex/oswap/oswap.js +43 -36
  69. package/build/dex/oswap/oswap.js.map +1 -1
  70. package/build/dex/platypus/platypus.d.ts +2 -1
  71. package/build/dex/platypus/platypus.js +31 -0
  72. package/build/dex/platypus/platypus.js.map +1 -1
  73. package/build/dex/swaap-v1/swaap-v1.d.ts +2 -1
  74. package/build/dex/swaap-v1/swaap-v1.js +10 -0
  75. package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
  76. package/build/dex/weth/config.js +3 -0
  77. package/build/dex/weth/config.js.map +1 -1
  78. package/package.json +1 -1
  79. package/src/abi/oswap/oswap.abi.json +452 -0
  80. package/src/dex/angle-transmuter/angle-transmuter.ts +1 -1
  81. package/src/dex/idex.ts +48 -41
  82. package/src/dex/index.ts +2 -0
  83. package/src/dex/oswap/config.ts +32 -0
  84. package/src/dex/oswap/oswap-e2e.test.ts +91 -0
  85. package/src/dex/oswap/oswap-events.test.ts +88 -0
  86. package/src/dex/oswap/oswap-integration.test.ts +269 -0
  87. package/src/dex/oswap/oswap-pool.ts +190 -0
  88. package/src/dex/oswap/oswap.ts +392 -0
  89. package/src/dex/oswap/types.ts +29 -0
  90. package/src/dex/weth/config.ts +3 -0
  91. package/src/dex/weth/weth-e2e.test.ts +156 -0
  92. package/.vscode/launch.json +0 -16
  93. package/.vscode/settings.json +0 -3
  94. package/build/abi/Uncompressor.json +0 -250
  95. package/build/abi/integral/factory.json +0 -333
  96. package/build/abi/integral/oracle.json +0 -501
  97. package/build/abi/integral/relayer.json +0 -1536
  98. package/build/abi/maverick-v2/MaverickV2Router.json +0 -778
  99. package/build/dex/bProtocol.d.ts +0 -18
  100. package/build/dex/bProtocol.js +0 -39
  101. package/build/dex/bProtocol.js.map +0 -1
  102. package/build/dex/bancor.d.ts +0 -26
  103. package/build/dex/bancor.js +0 -58
  104. package/build/dex/bancor.js.map +0 -1
  105. package/build/dex/compound.d.ts +0 -18
  106. package/build/dex/compound.js +0 -46
  107. package/build/dex/compound.js.map +0 -1
  108. package/build/dex/curve-v2.d.ts +0 -58
  109. package/build/dex/curve-v2.js +0 -180
  110. package/build/dex/curve-v2.js.map +0 -1
  111. package/build/dex/dodo-v1.d.ts +0 -33
  112. package/build/dex/dodo-v1.js +0 -63
  113. package/build/dex/dodo-v1.js.map +0 -1
  114. package/build/dex/etherfi/etherfi.d.ts +0 -26
  115. package/build/dex/etherfi/etherfi.js +0 -96
  116. package/build/dex/etherfi/etherfi.js.map +0 -1
  117. package/build/dex/integral/config.js +0 -20
  118. package/build/dex/integral/config.js.map +0 -1
  119. package/build/dex/integral/context.d.ts +0 -40
  120. package/build/dex/integral/context.js +0 -158
  121. package/build/dex/integral/context.js.map +0 -1
  122. package/build/dex/integral/helpers.d.ts +0 -17
  123. package/build/dex/integral/helpers.js +0 -157
  124. package/build/dex/integral/helpers.js.map +0 -1
  125. package/build/dex/integral/integral-factory.d.ts +0 -24
  126. package/build/dex/integral/integral-factory.js +0 -95
  127. package/build/dex/integral/integral-factory.js.map +0 -1
  128. package/build/dex/integral/integral-pool.d.ts +0 -50
  129. package/build/dex/integral/integral-pool.js +0 -149
  130. package/build/dex/integral/integral-pool.js.map +0 -1
  131. package/build/dex/integral/integral-pricing.d.ts +0 -18
  132. package/build/dex/integral/integral-pricing.js +0 -114
  133. package/build/dex/integral/integral-pricing.js.map +0 -1
  134. package/build/dex/integral/integral-relayer.d.ts +0 -42
  135. package/build/dex/integral/integral-relayer.js +0 -192
  136. package/build/dex/integral/integral-relayer.js.map +0 -1
  137. package/build/dex/integral/integral-token.d.ts +0 -27
  138. package/build/dex/integral/integral-token.js +0 -59
  139. package/build/dex/integral/integral-token.js.map +0 -1
  140. package/build/dex/integral/integral.js +0 -377
  141. package/build/dex/integral/integral.js.map +0 -1
  142. package/build/dex/integral/types.d.ts +0 -84
  143. package/build/dex/integral/types.js +0 -9
  144. package/build/dex/integral/types.js.map +0 -1
  145. package/build/dex/integral/utils-e2e.d.ts +0 -9
  146. package/build/dex/integral/utils-e2e.js +0 -131
  147. package/build/dex/integral/utils-e2e.js.map +0 -1
  148. package/build/dex/integral/utils.d.ts +0 -17
  149. package/build/dex/integral/utils.js +0 -94
  150. package/build/dex/integral/utils.js.map +0 -1
  151. package/build/dex/lido.d.ts +0 -19
  152. package/build/dex/lido.js +0 -42
  153. package/build/dex/lido.js.map +0 -1
  154. package/build/dex/onebit.d.ts +0 -25
  155. package/build/dex/onebit.js +0 -42
  156. package/build/dex/onebit.js.map +0 -1
  157. package/build/dex/sdai/config.d.ts +0 -11
  158. package/build/dex/sdai/config.js +0 -21
  159. package/build/dex/sdai/config.js.map +0 -1
  160. package/build/dex/sdai/constants.d.ts +0 -2
  161. package/build/dex/sdai/constants.js +0 -6
  162. package/build/dex/sdai/constants.js.map +0 -1
  163. package/build/dex/sdai/scripts/validate-state.d.ts +0 -1
  164. package/build/dex/sdai/scripts/validate-state.js +0 -102
  165. package/build/dex/sdai/scripts/validate-state.js.map +0 -1
  166. package/build/dex/sdai/sdai-pool.d.ts +0 -16
  167. package/build/dex/sdai/sdai-pool.js +0 -85
  168. package/build/dex/sdai/sdai-pool.js.map +0 -1
  169. package/build/dex/sdai/sdai.d.ts +0 -51
  170. package/build/dex/sdai/sdai.js +0 -172
  171. package/build/dex/sdai/sdai.js.map +0 -1
  172. package/build/dex/sdai/types.d.ts +0 -21
  173. package/build/dex/sdai/types.js +0 -11
  174. package/build/dex/sdai/types.js.map +0 -1
  175. package/build/dex/sdai/utils.d.ts +0 -4
  176. package/build/dex/sdai/utils.js +0 -39
  177. package/build/dex/sdai/utils.js.map +0 -1
  178. package/build/dex/smoothy.d.ts +0 -26
  179. package/build/dex/smoothy.js +0 -48
  180. package/build/dex/smoothy.js.map +0 -1
  181. package/build/dex/stable-pool.d.ts +0 -28
  182. package/build/dex/stable-pool.js +0 -62
  183. package/build/dex/stable-pool.js.map +0 -1
  184. package/build/dex/trader-joe-v2.1.d.ts +0 -43
  185. package/build/dex/trader-joe-v2.1.js +0 -79
  186. package/build/dex/trader-joe-v2.1.js.map +0 -1
  187. package/build/executor/compressor/Compressor.d.ts +0 -23
  188. package/build/executor/compressor/Compressor.js +0 -144
  189. package/build/executor/compressor/Compressor.js.map +0 -1
  190. package/build/executor/compressor/compress.d.ts +0 -17
  191. package/build/executor/compressor/compress.js +0 -187
  192. package/build/executor/compressor/compress.js.map +0 -1
  193. package/build/executor/compressor/compress_functions/addressSubstitution.d.ts +0 -6
  194. package/build/executor/compressor/compress_functions/addressSubstitution.js +0 -29
  195. package/build/executor/compressor/compress_functions/addressSubstitution.js.map +0 -1
  196. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.d.ts +0 -10
  197. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js +0 -40
  198. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js.map +0 -1
  199. package/build/executor/compressor/compress_functions/byteSubstitution.d.ts +0 -11
  200. package/build/executor/compressor/compress_functions/byteSubstitution.js +0 -64
  201. package/build/executor/compressor/compress_functions/byteSubstitution.js.map +0 -1
  202. package/build/executor/compressor/compress_functions/ffSubstitution.d.ts +0 -7
  203. package/build/executor/compressor/compress_functions/ffSubstitution.js +0 -54
  204. package/build/executor/compressor/compress_functions/ffSubstitution.js.map +0 -1
  205. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.d.ts +0 -8
  206. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js +0 -67
  207. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js.map +0 -1
  208. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.d.ts +0 -8
  209. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js +0 -61
  210. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js.map +0 -1
  211. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.d.ts +0 -6
  212. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js +0 -37
  213. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js.map +0 -1
  214. package/build/executor/compressor/compress_functions/searchUnusedBytes.d.ts +0 -9
  215. package/build/executor/compressor/compress_functions/searchUnusedBytes.js +0 -33
  216. package/build/executor/compressor/compress_functions/searchUnusedBytes.js.map +0 -1
  217. package/build/executor/compressor/fetchSaved.d.ts +0 -0
  218. package/build/executor/compressor/fetchSaved.js +0 -17
  219. package/build/executor/compressor/fetchSaved.js.map +0 -1
  220. package/build/executor/compressor/utils/computeCostL2.d.ts +0 -2
  221. package/build/executor/compressor/utils/computeCostL2.js +0 -14
  222. package/build/executor/compressor/utils/computeCostL2.js.map +0 -1
  223. package/build/executor/compressor/utils/findLongestDuplicatedString.d.ts +0 -2
  224. package/build/executor/compressor/utils/findLongestDuplicatedString.js +0 -30
  225. package/build/executor/compressor/utils/findLongestDuplicatedString.js.map +0 -1
  226. package/build/executor/compressor/utils/getAllIndexes.d.ts +0 -2
  227. package/build/executor/compressor/utils/getAllIndexes.js +0 -12
  228. package/build/executor/compressor/utils/getAllIndexes.js.map +0 -1
  229. package/build/executor/compressor/utils/getByteForAddress.d.ts +0 -2
  230. package/build/executor/compressor/utils/getByteForAddress.js +0 -14
  231. package/build/executor/compressor/utils/getByteForAddress.js.map +0 -1
  232. package/build/executor/compressor/utils/intTo2Bytes.d.ts +0 -2
  233. package/build/executor/compressor/utils/intTo2Bytes.js +0 -14
  234. package/build/executor/compressor/utils/intTo2Bytes.js.map +0 -1
  235. package/build/executor/compressor/utils/intTo3Bytes.d.ts +0 -2
  236. package/build/executor/compressor/utils/intTo3Bytes.js +0 -18
  237. package/build/executor/compressor/utils/intTo3Bytes.js.map +0 -1
  238. package/build/executor/compressor/utils/intToByte.d.ts +0 -2
  239. package/build/executor/compressor/utils/intToByte.js +0 -10
  240. package/build/executor/compressor/utils/intToByte.js.map +0 -1
@@ -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
+ ]
@@ -102,7 +102,7 @@ export class AngleTransmuter
102
102
  // Returns the list of contract adapters (name and index)
103
103
  // for a buy/sell. Return null if there are no adapters.
104
104
  getAdapters(side: SwapSide): { name: string; index: number }[] | null {
105
- return this.adapters[side] ? this.adapters[side] : null;
105
+ return null;
106
106
  }
107
107
 
108
108
  // Returns list of pool identifiers that can be used
package/src/dex/idex.ts CHANGED
@@ -24,34 +24,7 @@ export type Context = {
24
24
  isGlobalDestToken: boolean;
25
25
  };
26
26
 
27
- export interface IDexTxBuilder<ExchangeData, DirectParam = null> {
28
- needWrapNative: boolean;
29
- needsSequentialPreprocessing?: boolean;
30
-
31
- // Returns the ETH fee required to swap
32
- // It is optional for a DEX to implement this
33
- // This is a legacy function and will be removed soon
34
- getNetworkFee?(
35
- srcToken: Address,
36
- destToken: Address,
37
- srcAmount: NumberAsString,
38
- destAmount: NumberAsString,
39
- data: ExchangeData,
40
- side: SwapSide,
41
- ): NumberAsString;
42
-
43
- // If exists, called before getAdapterParam to use async calls and receive data if needed
44
- preProcessTransaction?(
45
- optimalSwapExchange: OptimalSwapExchange<ExchangeData>,
46
- srcToken: Token,
47
- destToken: Token,
48
- side: SwapSide,
49
- options: PreprocessTransactionOptions,
50
- ): AsyncOrSync<[OptimalSwapExchange<ExchangeData>, ExchangeTxInfo]>;
51
-
52
- // This is helper a function to support testing if preProcessTransaction is implemented
53
- getTokenFromAddress?(address: Address): Token;
54
-
27
+ export interface IDexTxBuilderV5<ExchangeData, DirectParam = null> {
55
28
  // Encode params required by the exchange adapter
56
29
  // V5: Used for multiSwap, buy & megaSwap
57
30
  // V6: NOT used, pass a placeholder
@@ -76,18 +49,6 @@ export interface IDexTxBuilder<ExchangeData, DirectParam = null> {
76
49
  side: SwapSide,
77
50
  ): AsyncOrSync<SimpleExchangeParam>;
78
51
 
79
- getDexParam?(
80
- srcToken: Address,
81
- destToken: Address,
82
- srcAmount: NumberAsString,
83
- destAmount: NumberAsString,
84
- recipient: Address,
85
- data: ExchangeData,
86
- side: SwapSide,
87
- context: Context,
88
- executorAddress: Address,
89
- ): AsyncOrSync<DexExchangeParam>;
90
-
91
52
  // Returns params required by direct swap method.
92
53
  // Only Dexes which have a direct method should implement this
93
54
  // Used if there is a possibility for direct swap (Eg. UniswapV2,
@@ -108,8 +69,23 @@ export interface IDexTxBuilder<ExchangeData, DirectParam = null> {
108
69
  beneficiary: string,
109
70
  contractMethod: string,
110
71
  ): TxInfo<DirectParam>;
72
+ }
111
73
 
112
- // Same as above but for V6
74
+ export interface IDexTxBuilderV6<ExchangeData, DirectParam = null> {
75
+ // Returns params required by generic method
76
+ getDexParam?(
77
+ srcToken: Address,
78
+ destToken: Address,
79
+ srcAmount: NumberAsString,
80
+ destAmount: NumberAsString,
81
+ recipient: Address,
82
+ data: ExchangeData,
83
+ side: SwapSide,
84
+ context: Context,
85
+ executorAddress: Address,
86
+ ): AsyncOrSync<DexExchangeParam>;
87
+
88
+ // Returns params for direct method
113
89
  getDirectParamV6?(
114
90
  srcToken: Address,
115
91
  destToken: Address,
@@ -127,6 +103,37 @@ export interface IDexTxBuilder<ExchangeData, DirectParam = null> {
127
103
  ): TxInfo<DirectParam>;
128
104
  }
129
105
 
106
+ export interface IDexTxBuilder<ExchangeData, DirectParam = null>
107
+ extends IDexTxBuilderV5<ExchangeData, DirectParam>,
108
+ IDexTxBuilderV6<ExchangeData, DirectParam> {
109
+ needWrapNative: boolean;
110
+ needsSequentialPreprocessing?: boolean;
111
+
112
+ // Returns the ETH fee required to swap
113
+ // It is optional for a DEX to implement this
114
+ // This is a legacy function and will be removed soon
115
+ getNetworkFee?(
116
+ srcToken: Address,
117
+ destToken: Address,
118
+ srcAmount: NumberAsString,
119
+ destAmount: NumberAsString,
120
+ data: ExchangeData,
121
+ side: SwapSide,
122
+ ): NumberAsString;
123
+
124
+ // If exists, called before getAdapterParam to use async calls and receive data if needed
125
+ preProcessTransaction?(
126
+ optimalSwapExchange: OptimalSwapExchange<ExchangeData>,
127
+ srcToken: Token,
128
+ destToken: Token,
129
+ side: SwapSide,
130
+ options: PreprocessTransactionOptions,
131
+ ): AsyncOrSync<[OptimalSwapExchange<ExchangeData>, ExchangeTxInfo]>;
132
+
133
+ // This is helper a function to support testing if preProcessTransaction is implemented
134
+ getTokenFromAddress?(address: Address): Token;
135
+ }
136
+
130
137
  export interface IDexPricing<ExchangeData> {
131
138
  readonly dexKey: string;
132
139
  // This is true if the the DEX is simply
package/src/dex/index.ts CHANGED
@@ -81,6 +81,7 @@ import { EtherFi } from './etherfi';
81
81
  import { Spark } from './spark/spark';
82
82
  import { VelodromeSlipstream } from './uniswap-v3/forks/velodrome-slipstream/velodrome-slipstream';
83
83
  import { AaveV3Stata } from './aave-v3-stata/aave-v3-stata';
84
+ import { OSwap } from './oswap/oswap';
84
85
  import { ConcentratorArusd } from './concentrator-arusd/concentrator-arusd';
85
86
  import { FxProtocolRusd } from './fx-protocol-rusd/fx-protocol-rusd';
86
87
 
@@ -159,6 +160,7 @@ const Dexes = [
159
160
  PharaohV1,
160
161
  Spark,
161
162
  AaveV3Stata,
163
+ OSwap,
162
164
  ConcentratorArusd,
163
165
  FxProtocolRusd,
164
166
  ];
@@ -0,0 +1,32 @@
1
+ import { DexParams } from './types';
2
+ import { DexConfigMap, AdapterMappings } from '../../types';
3
+ import { Network, SwapSide } from '../../constants';
4
+
5
+ export const OSWAP_GAS_COST = 80_000;
6
+
7
+ // Important:
8
+ // - All addresses should be lower case.
9
+ // - Only tokens with 18 decimals are supported.
10
+ export const OSwapConfig: DexConfigMap<DexParams> = {
11
+ OSwap: {
12
+ [Network.MAINNET]: {
13
+ pools: [
14
+ {
15
+ id: 'OSwap_0x85b78aca6deae198fbf201c82daf6ca21942acc6', // Pool identifier: `{dex_key}_{pool_address}`
16
+ address: '0x85b78aca6deae198fbf201c82daf6ca21942acc6', // Address of the pool
17
+ token0: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH
18
+ token1: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84', // STETH
19
+ },
20
+ ],
21
+ },
22
+ },
23
+ };
24
+
25
+ export const Adapters: Record<number, AdapterMappings> = {
26
+ [Network.MAINNET]: {
27
+ // Note: We re-use the SmarDex adapters since it implements
28
+ // an Uniswap V2 router compatible interface, which OSwap supports.
29
+ [SwapSide.SELL]: [{ name: 'Adapter04', index: 6 }],
30
+ [SwapSide.BUY]: [{ name: 'BuyAdapter02', index: 2 }],
31
+ },
32
+ };