@paraswap/dex-lib 3.9.7-fluid-dex.2 → 3.10.0

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 (234) hide show
  1. package/.vscode/launch.json +53 -0
  2. package/.vscode/settings.json +2 -0
  3. package/.vscode/tasks.json +15 -0
  4. package/build/abi/{integral/pool.json → inception/inception-ineth-pool.json} +558 -537
  5. package/build/abi/inception/inception-ratio-feed.json +329 -0
  6. package/build/abi/inception/inception-vault.json +991 -0
  7. package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +52 -0
  8. package/build/abi/{integral/relayer.json → wombat/pool.json} +474 -721
  9. package/build/config.js +28 -0
  10. package/build/config.js.map +1 -1
  11. package/build/constants.d.ts +2 -1
  12. package/build/constants.js +1 -0
  13. package/build/constants.js.map +1 -1
  14. package/build/dex/aave-v1/aave-v1.d.ts +2 -1
  15. package/build/dex/aave-v1/aave-v1.js +23 -0
  16. package/build/dex/aave-v1/aave-v1.js.map +1 -1
  17. package/build/dex/aave-v2/tokens-avalanche.json +44 -0
  18. package/build/dex/aave-v2/tokens-mainnet.json +188 -0
  19. package/build/dex/aave-v2/tokens-polygon.json +44 -0
  20. package/build/dex/aave-v3/aave-v3.js +1 -1
  21. package/build/dex/aave-v3/aave-v3.js.map +1 -1
  22. package/build/dex/aave-v3/config.js +6 -0
  23. package/build/dex/aave-v3/config.js.map +1 -1
  24. package/build/dex/aave-v3-stata/config.js +3 -3
  25. package/build/dex/aave-v3-stata/config.js.map +1 -1
  26. package/build/dex/algebra/algebra-pool-v1_9_bidirectional_fee.js +1 -1
  27. package/build/dex/algebra/algebra-pool-v1_9_bidirectional_fee.js.map +1 -1
  28. package/build/dex/algebra/config.js +20 -0
  29. package/build/dex/algebra/config.js.map +1 -1
  30. package/build/dex/balancer-v2/balancer-v2.js +1 -1
  31. package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
  32. package/build/dex/balancer-v2/config.js +4 -0
  33. package/build/dex/balancer-v2/config.js.map +1 -1
  34. package/build/dex/curve-v1/config.js +36 -0
  35. package/build/dex/curve-v1/config.js.map +1 -1
  36. package/build/dex/curve-v1/curve-v1.js +1 -1
  37. package/build/dex/curve-v1/curve-v1.js.map +1 -1
  38. package/build/dex/curve-v1-factory/constants.js +1 -0
  39. package/build/dex/curve-v1-factory/constants.js.map +1 -1
  40. package/build/dex/curve-v1-factory/curve-v1-factory.js +1 -1
  41. package/build/dex/curve-v1-factory/curve-v1-factory.js.map +1 -1
  42. package/build/dex/curve-v1-stable-ng/config.js +28 -0
  43. package/build/dex/curve-v1-stable-ng/config.js.map +1 -1
  44. package/build/dex/inception/config.d.ts +4 -0
  45. package/build/dex/inception/config.js +109 -0
  46. package/build/dex/inception/config.js.map +1 -0
  47. package/build/dex/inception/inception-event-pool.d.ts +16 -0
  48. package/build/dex/inception/inception-event-pool.js +49 -0
  49. package/build/dex/inception/inception-event-pool.js.map +1 -0
  50. package/build/dex/inception/inception.d.ts +43 -0
  51. package/build/dex/inception/inception.js +180 -0
  52. package/build/dex/inception/inception.js.map +1 -0
  53. package/build/dex/inception/tokens.d.ts +9 -0
  54. package/build/dex/inception/tokens.js +28 -0
  55. package/build/dex/inception/tokens.js.map +1 -0
  56. package/build/dex/inception/types.d.ts +22 -0
  57. package/build/dex/{fluid-dex → inception}/types.js.map +1 -1
  58. package/build/dex/inception/utils.d.ts +7 -0
  59. package/build/dex/inception/utils.js +58 -0
  60. package/build/dex/inception/utils.js.map +1 -0
  61. package/build/dex/index.js +0 -2
  62. package/build/dex/index.js.map +1 -1
  63. package/build/dex/jarvis.d.ts +2 -1
  64. package/build/dex/jarvis.js +58 -0
  65. package/build/dex/jarvis.js.map +1 -1
  66. package/build/dex/maker-psm/scripts/gem.abi.json +136 -0
  67. package/build/dex/maker-psm/scripts/validate-state.d.ts +0 -0
  68. package/build/dex/maker-psm/scripts/validate-state.js +185 -0
  69. package/build/dex/maker-psm/scripts/validate-state.js.map +1 -0
  70. package/build/dex/maker-psm/scripts/vat.abi.json +243 -0
  71. package/build/dex/platypus/platypus.d.ts +2 -1
  72. package/build/dex/platypus/platypus.js +45 -0
  73. package/build/dex/platypus/platypus.js.map +1 -1
  74. package/build/dex/solidly-v3/scripts/check-event-pool-event.d.ts +1 -0
  75. package/build/dex/solidly-v3/scripts/check-event-pool-event.js +53 -0
  76. package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +1 -0
  77. package/build/dex/stable-pool.js +1 -8
  78. package/build/dex/stable-pool.js.map +1 -1
  79. package/build/dex/swaap-v1/swaap-v1.d.ts +2 -1
  80. package/build/dex/swaap-v1/swaap-v1.js +14 -0
  81. package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
  82. package/build/dex/uniswap-v2/config.js +14 -0
  83. package/build/dex/uniswap-v2/config.js.map +1 -1
  84. package/build/dex/uniswap-v2/nomiswap-v2.js +10 -0
  85. package/build/dex/uniswap-v2/nomiswap-v2.js.map +1 -1
  86. package/build/dex/uniswap-v2/uniswap-v2.js +1 -1
  87. package/build/dex/uniswap-v2/uniswap-v2.js.map +1 -1
  88. package/build/dex/uniswap-v3/config.js +14 -0
  89. package/build/dex/uniswap-v3/config.js.map +1 -1
  90. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +17 -0
  91. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +64 -0
  92. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +1 -0
  93. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +17 -0
  94. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +79 -0
  95. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +1 -0
  96. package/build/dex/uniswap-v3/uniswap-v3-pricing.d.ts +4 -0
  97. package/build/dex/uniswap-v3/uniswap-v3-pricing.js +43 -0
  98. package/build/dex/uniswap-v3/uniswap-v3-pricing.js.map +1 -0
  99. package/build/dex/uniswap-v3/uniswap-v3-worker.d.ts +1 -0
  100. package/build/dex/uniswap-v3/uniswap-v3-worker.js +10 -0
  101. package/build/dex/uniswap-v3/uniswap-v3-worker.js.map +1 -0
  102. package/build/dex/uniswap-v3/uniswap-v3.js +1 -0
  103. package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
  104. package/build/dex/weth/config.js +5 -0
  105. package/build/dex/weth/config.js.map +1 -1
  106. package/build/dex/wusdm/config.js +8 -0
  107. package/build/dex/wusdm/config.js.map +1 -1
  108. package/build/dex/wusdm/wusdm.d.ts +1 -0
  109. package/build/dex/wusdm/wusdm.js +9 -4
  110. package/build/dex/wusdm/wusdm.js.map +1 -1
  111. package/build/dex/zerox/index.d.ts +4 -26
  112. package/build/dex/zerox/index.js +50 -42
  113. package/build/dex/zerox/index.js.map +1 -1
  114. package/build/dex/zerox/types.d.ts +29 -0
  115. package/build/dex/zerox/types.js +8 -1
  116. package/build/dex/zerox/types.js.map +1 -1
  117. package/build/executor/WETHBytecodeBuilder.js +1 -0
  118. package/build/executor/WETHBytecodeBuilder.js.map +1 -1
  119. package/package.json +1 -1
  120. package/src/config.ts +29 -1
  121. package/src/constants.ts +1 -0
  122. package/src/dex/aave-v3/aave-v3-e2e.test.ts +69 -0
  123. package/src/dex/aave-v3/aave-v3.ts +1 -1
  124. package/src/dex/aave-v3/config.ts +7 -0
  125. package/src/dex/aave-v3-stata/config.ts +4 -4
  126. package/src/dex/algebra/algebra-e2e.test.ts +22 -0
  127. package/src/dex/algebra/algebra-pool-v1_9_bidirectional_fee.ts +1 -1
  128. package/src/dex/algebra/config.ts +21 -0
  129. package/src/dex/balancer-v2/balancer-v2-e2e.test.ts +22 -250
  130. package/src/dex/balancer-v2/balancer-v2.ts +1 -1
  131. package/src/dex/balancer-v2/config.ts +4 -0
  132. package/src/dex/curve-v1/config.ts +36 -0
  133. package/src/dex/curve-v1/curve-v1-e2e.test.ts +69 -0
  134. package/src/dex/curve-v1/curve-v1.ts +1 -1
  135. package/src/dex/curve-v1-factory/constants.ts +1 -0
  136. package/src/dex/curve-v1-factory/curve-v1-factory.ts +2 -1
  137. package/src/dex/curve-v1-stable-ng/config.ts +28 -0
  138. package/src/dex/curve-v1-stable-ng/curve-v1-stable-ng-e2e.test.ts +20 -0
  139. package/src/dex/index.ts +0 -2
  140. package/src/dex/uniswap-v2/config.ts +16 -0
  141. package/src/dex/uniswap-v2/nomiswap-v2.ts +11 -0
  142. package/src/dex/uniswap-v2/uniswap-v2-e2e-gnosis.test.ts +283 -0
  143. package/src/dex/uniswap-v2/uniswap-v2.ts +1 -1
  144. package/src/dex/uniswap-v3/config.ts +14 -0
  145. package/src/dex/uniswap-v3/uniswap-v3-e2e.test.ts +24 -0
  146. package/src/dex/uniswap-v3/uniswap-v3.ts +1 -0
  147. package/src/dex/weth/config.ts +5 -0
  148. package/src/dex/wusdm/config.ts +8 -0
  149. package/src/dex/wusdm/wusdm-e2e.test.ts +38 -0
  150. package/src/dex/wusdm/wusdm.ts +11 -4
  151. package/src/executor/WETHBytecodeBuilder.ts +3 -2
  152. package/tests/constants-e2e.ts +77 -2
  153. package/.idea/aws.xml +0 -17
  154. package/.idea/codeStyles/Project.xml +0 -19
  155. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  156. package/.idea/misc.xml +0 -6
  157. package/.idea/modules.xml +0 -8
  158. package/.idea/paraswap-dex-lib.iml +0 -9
  159. package/.idea/prettier.xml +0 -7
  160. package/.idea/vcs.xml +0 -6
  161. package/build/abi/fluid-dex/dexFactory.abi.json +0 -506
  162. package/build/abi/fluid-dex/fluid-dex.abi.json +0 -922
  163. package/build/abi/fluid-dex/liquidityUserModule.abi.json +0 -145
  164. package/build/abi/fluid-dex/resolver.abi.json +0 -999
  165. package/build/abi/integral/factory.json +0 -333
  166. package/build/abi/integral/oracle.json +0 -501
  167. package/build/dex/fluid-dex/config.d.ts +0 -4
  168. package/build/dex/fluid-dex/config.js +0 -20
  169. package/build/dex/fluid-dex/config.js.map +0 -1
  170. package/build/dex/fluid-dex/fluid-dex-generate-pool.d.ts +0 -49
  171. package/build/dex/fluid-dex/fluid-dex-generate-pool.js +0 -104
  172. package/build/dex/fluid-dex/fluid-dex-generate-pool.js.map +0 -1
  173. package/build/dex/fluid-dex/fluid-dex-pool.d.ts +0 -47
  174. package/build/dex/fluid-dex/fluid-dex-pool.js +0 -119
  175. package/build/dex/fluid-dex/fluid-dex-pool.js.map +0 -1
  176. package/build/dex/fluid-dex/fluid-dex.d.ts +0 -127
  177. package/build/dex/fluid-dex/fluid-dex.js +0 -502
  178. package/build/dex/fluid-dex/fluid-dex.js.map +0 -1
  179. package/build/dex/fluid-dex/types.d.ts +0 -52
  180. package/build/dex/integral/config.d.ts +0 -4
  181. package/build/dex/integral/config.js +0 -20
  182. package/build/dex/integral/config.js.map +0 -1
  183. package/build/dex/integral/context.d.ts +0 -40
  184. package/build/dex/integral/context.js +0 -158
  185. package/build/dex/integral/context.js.map +0 -1
  186. package/build/dex/integral/integral-factory.d.ts +0 -24
  187. package/build/dex/integral/integral-factory.js +0 -95
  188. package/build/dex/integral/integral-factory.js.map +0 -1
  189. package/build/dex/integral/integral-pool.d.ts +0 -50
  190. package/build/dex/integral/integral-pool.js +0 -149
  191. package/build/dex/integral/integral-pool.js.map +0 -1
  192. package/build/dex/integral/integral-pricing.d.ts +0 -18
  193. package/build/dex/integral/integral-pricing.js +0 -114
  194. package/build/dex/integral/integral-pricing.js.map +0 -1
  195. package/build/dex/integral/integral-relayer.d.ts +0 -42
  196. package/build/dex/integral/integral-relayer.js +0 -192
  197. package/build/dex/integral/integral-relayer.js.map +0 -1
  198. package/build/dex/integral/integral-token.d.ts +0 -27
  199. package/build/dex/integral/integral-token.js +0 -59
  200. package/build/dex/integral/integral-token.js.map +0 -1
  201. package/build/dex/integral/integral.d.ts +0 -41
  202. package/build/dex/integral/integral.js +0 -376
  203. package/build/dex/integral/integral.js.map +0 -1
  204. package/build/dex/integral/types.d.ts +0 -85
  205. package/build/dex/integral/types.js +0 -9
  206. package/build/dex/integral/types.js.map +0 -1
  207. package/build/dex/integral/utils-e2e.d.ts +0 -9
  208. package/build/dex/integral/utils-e2e.js +0 -131
  209. package/build/dex/integral/utils-e2e.js.map +0 -1
  210. package/build/dex/integral/utils.d.ts +0 -17
  211. package/build/dex/integral/utils.js +0 -94
  212. package/build/dex/integral/utils.js.map +0 -1
  213. package/build/dex/trader-joe-v2.1/optimizer.d.ts +0 -2
  214. package/build/dex/trader-joe-v2.1/optimizer.js +0 -47
  215. package/build/dex/trader-joe-v2.1/optimizer.js.map +0 -1
  216. package/src/abi/fluid-dex/dexFactory.abi.json +0 -506
  217. package/src/abi/fluid-dex/fluid-dex.abi.json +0 -922
  218. package/src/abi/fluid-dex/liquidityUserModule.abi.json +0 -145
  219. package/src/abi/fluid-dex/resolver.abi.json +0 -999
  220. package/src/dex/fluid-dex/config.ts +0 -20
  221. package/src/dex/fluid-dex/fluid-dex-e2e.test.ts +0 -154
  222. package/src/dex/fluid-dex/fluid-dex-events.test.ts +0 -294
  223. package/src/dex/fluid-dex/fluid-dex-generate-pool.ts +0 -143
  224. package/src/dex/fluid-dex/fluid-dex-integration.test.ts +0 -304
  225. package/src/dex/fluid-dex/fluid-dex-pool.ts +0 -178
  226. package/src/dex/fluid-dex/fluid-dex.ts +0 -780
  227. package/src/dex/fluid-dex/types.ts +0 -62
  228. package/tests/constants-e2e.d.ts +0 -22
  229. package/tests/constants-e2e.js +0 -1942
  230. package/tests/constants-e2e.js.map +0 -1
  231. package/tests/smart-tokens.d.ts +0 -36
  232. package/tests/smart-tokens.js +0 -64
  233. package/tests/smart-tokens.js.map +0 -1
  234. /package/build/dex/{fluid-dex → inception}/types.js +0 -0
@@ -29,6 +29,7 @@ export const NETWORK_ID_TO_NAME: Record<number, string> = {
29
29
  [Network.ARBITRUM]: 'arbitrum',
30
30
  [Network.OPTIMISM]: 'optimism',
31
31
  [Network.BASE]: 'base',
32
+ [Network.GNOSIS]: 'xdai',
32
33
  };
33
34
 
34
35
  // They are hardcoded in factory contract. If factory is changing, must be
@@ -605,7 +605,8 @@ export class CurveV1Factory
605
605
  const allResultsFromFactory = (
606
606
  await this.dexHelper.multiWrapper.tryAggregate<
607
607
  string[] | number[] | string
608
- >(true, callDataFromFactoryPools)
608
+ // decrease batch size to 450 to avoid 'out-of-limit' error on gnosis
609
+ >(true, callDataFromFactoryPools, undefined, 450)
609
610
  ).map(r => r.returnData);
610
611
 
611
612
  const resultsFromFactory = allResultsFromFactory.slice(
@@ -192,6 +192,34 @@ const CurveV1StableNgConfig: DexConfigMap<DexParams> = {
192
192
  },
193
193
  customPools: {},
194
194
  },
195
+ [Network.GNOSIS]: {
196
+ factories: [
197
+ {
198
+ address: '0xbc0797015fcfc47d9c1856639cae50d0e69fbee8',
199
+ isStableNg: true,
200
+ },
201
+ ],
202
+ router: '0x0dcded3545d565ba3b19e683431381007245d983', // https://github.com/curvefi/curve-router-ng
203
+ stateUpdatePeriodMs: 5 * 1000,
204
+ disabledPools: new Set([]),
205
+ disabledImplementations: new Set([]),
206
+ factoryPoolImplementations: {
207
+ // TODO-gnosis: check if there's no missing implementations
208
+ '0x3d6cb2f6dcf47cdd9c13e4e3beae9af041d8796a': {
209
+ name: ImplementationNames.FACTORY_STABLE_NG,
210
+ address: '0x3d6cb2f6dcf47cdd9c13e4e3beae9af041d8796a',
211
+ liquidityApiSlug: '/factory-stable-ng',
212
+ isStoreRateSupported: true,
213
+ },
214
+ '0xc1b393efef38140662b91441c6710aa704973228': {
215
+ name: ImplementationNames.FACTORY_STABLE_NG,
216
+ address: '0xc1b393efef38140662b91441c6710aa704973228',
217
+ liquidityApiSlug: '/factory-stable-ng',
218
+ isStoreRateSupported: true,
219
+ },
220
+ },
221
+ customPools: {},
222
+ },
195
223
  },
196
224
  };
197
225
 
@@ -196,4 +196,24 @@ describe('CurveV1StableNG E2E', () => {
196
196
  sidesToContractMethods,
197
197
  );
198
198
  });
199
+
200
+ describe('Gnosis', () => {
201
+ const network = Network.GNOSIS;
202
+
203
+ const tokenASymbol: string = 'sDAI';
204
+ const tokenBSymbol: string = 'crvUSD';
205
+
206
+ const tokenAAmount: string = '1000000000000000000';
207
+ const tokenBAmount: string = '1000000000000000000';
208
+
209
+ testForNetwork(
210
+ network,
211
+ dexKey,
212
+ tokenASymbol,
213
+ tokenBSymbol,
214
+ tokenAAmount,
215
+ tokenBAmount,
216
+ sidesToContractMethods,
217
+ );
218
+ });
199
219
  });
package/src/dex/index.ts CHANGED
@@ -86,7 +86,6 @@ import { Spark } from './spark/spark';
86
86
  import { VelodromeSlipstream } from './uniswap-v3/forks/velodrome-slipstream/velodrome-slipstream';
87
87
  import { AaveV3Stata } from './aave-v3-stata/aave-v3-stata';
88
88
  import { OSwap } from './oswap/oswap';
89
- import { FluidDex } from './fluid-dex/fluid-dex';
90
89
  import { ConcentratorArusd } from './concentrator-arusd/concentrator-arusd';
91
90
  import { FxProtocolRusd } from './fx-protocol-rusd/fx-protocol-rusd';
92
91
  import { AaveGsm } from './aave-gsm/aave-gsm';
@@ -182,7 +181,6 @@ const Dexes = [
182
181
  UsualBond,
183
182
  StkGHO,
184
183
  SkyConverter,
185
- FluidDex,
186
184
  ];
187
185
 
188
186
  export type LegacyDexConstructor = new (dexHelper: IDexHelper) => IDexTxBuilder<
@@ -427,6 +427,22 @@ export const UniswapV2Config: DexConfigMap<DexParams> = {
427
427
  '0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303',
428
428
  feeCode: 30,
429
429
  },
430
+ [Network.GNOSIS]: {
431
+ subgraphURL: '7czeiia7ZXvsW45szX2w8EK1ZNgZWZET83zYCwE6JT9x',
432
+ factoryAddress: '0xc35dadb65012ec5796536bd9864ed8773abc74c4',
433
+ initCode:
434
+ '0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303',
435
+ feeCode: 30,
436
+ },
437
+ },
438
+ HoneySwap: {
439
+ [Network.GNOSIS]: {
440
+ subgraphURL: '7vjh6q6gj6M1bhRNgkKZmWqd5jot79kV84BiQtUDQSdV',
441
+ factoryAddress: '0xa818b4f111ccac7aa31d0bcc0806d64f2e0737d7',
442
+ initCode:
443
+ '0xdbd265d4828759db2a0351a7b97180bcc41449a038bcd08a45afe937147f6267',
444
+ feeCode: 30,
445
+ },
430
446
  },
431
447
  Zyberswap: {
432
448
  [Network.ARBITRUM]: {
@@ -18,6 +18,17 @@ export const NomiswapV2Config: DexConfigMap<DexParams> = {
18
18
  subgraphURL: '5CBKsDihF7KeBrNX4bgtb4tVFqy41PguVm88zBGpd4Hi',
19
19
  },
20
20
  },
21
+ // not exactly the same, but swapFee logic works in the same way
22
+ SwaprV2: {
23
+ [Network.GNOSIS]: {
24
+ factoryAddress: '0x5D48C95AdfFD4B40c1AAADc4e08fc44117E02179',
25
+ initCode:
26
+ '0xfcee8e246628cf9708fcb9d6f5d4aa0d96b62bb50f1af012a75a3292849e2dca',
27
+ poolGasCost: 120 * 1000,
28
+ feeCode: 25, // this is ignored as SwaprV2 uses dynamic fees,
29
+ subgraphURL: 'EWoa3JwNntAWtaLsLixTU25smp4R5tzGvs9rFXx9NHKZ',
30
+ },
31
+ },
21
32
  };
22
33
 
23
34
  export class NomiswapV2 extends UniswapV2 {
@@ -0,0 +1,283 @@
1
+ import dotenv from 'dotenv';
2
+ dotenv.config();
3
+
4
+ import { testE2E } from '../../../tests/utils-e2e';
5
+ import { Tokens, Holders } from '../../../tests/constants-e2e';
6
+ import { Network, ContractMethod, SwapSide } from '../../constants';
7
+ import { StaticJsonRpcProvider } from '@ethersproject/providers';
8
+ import { generateConfig } from '../../config';
9
+
10
+ describe('UniswapV2 E2E Gnosis', () => {
11
+ const network = Network.GNOSIS;
12
+ const tokens = Tokens[network];
13
+ const holders = Holders[network];
14
+ const provider = new StaticJsonRpcProvider(
15
+ generateConfig(network).privateHttpProvider,
16
+ network,
17
+ );
18
+
19
+ describe('SushiSwap', () => {
20
+ const dexKey = 'SushiSwap';
21
+
22
+ describe('swapExactAmountIn', () => {
23
+ it('SushiSwap ETH -> TOKEN', async () => {
24
+ await testE2E(
25
+ tokens.XDAI,
26
+ tokens.USDC,
27
+ holders.XDAI,
28
+ '700000000000000000',
29
+ SwapSide.SELL,
30
+ dexKey,
31
+ ContractMethod.swapExactAmountIn,
32
+ network,
33
+ provider,
34
+ );
35
+ });
36
+ it('SushiSwap TOKEN -> ETH', async () => {
37
+ await testE2E(
38
+ tokens.WETH,
39
+ tokens.XDAI,
40
+ holders.WETH,
41
+ '700000000000000000',
42
+ SwapSide.SELL,
43
+ dexKey,
44
+ ContractMethod.swapExactAmountIn,
45
+ network,
46
+ provider,
47
+ );
48
+ });
49
+ it('SushiSwap TOKEN -> TOKEN', async () => {
50
+ await testE2E(
51
+ tokens.WETH,
52
+ tokens.USDC,
53
+ holders.WETH,
54
+ '7000000000000000',
55
+ SwapSide.SELL,
56
+ dexKey,
57
+ ContractMethod.swapExactAmountIn,
58
+ network,
59
+ provider,
60
+ );
61
+ });
62
+ });
63
+
64
+ describe('swapExactAmountOut', () => {
65
+ it('SushiSwap ETH -> TOKEN', async () => {
66
+ await testE2E(
67
+ tokens.XDAI,
68
+ tokens.USDC,
69
+ holders.XDAI,
70
+ '700000000',
71
+ SwapSide.BUY,
72
+ dexKey,
73
+ ContractMethod.swapExactAmountOut,
74
+ network,
75
+ provider,
76
+ );
77
+ });
78
+ it('SushiSwap TOKEN -> ETH', async () => {
79
+ await testE2E(
80
+ tokens.USDC,
81
+ tokens.XDAI,
82
+ holders.USDC,
83
+ '7000000000000000000',
84
+ SwapSide.BUY,
85
+ dexKey,
86
+ ContractMethod.swapExactAmountOut,
87
+ network,
88
+ provider,
89
+ );
90
+ });
91
+ it('SushiSwap TOKEN -> TOKEN', async () => {
92
+ await testE2E(
93
+ tokens.USDC,
94
+ tokens.WETH,
95
+ holders.USDC,
96
+ '7000000000000000',
97
+ SwapSide.BUY,
98
+ dexKey,
99
+ ContractMethod.swapExactAmountOut,
100
+ network,
101
+ provider,
102
+ );
103
+ });
104
+ });
105
+ });
106
+
107
+ describe('HoneySwap', () => {
108
+ const dexKey = 'HoneySwap';
109
+
110
+ describe('swapExactAmountIn', () => {
111
+ it('SushiSwap ETH -> TOKEN', async () => {
112
+ await testE2E(
113
+ tokens.XDAI,
114
+ tokens.USDC,
115
+ holders.XDAI,
116
+ '700000000000000000',
117
+ SwapSide.SELL,
118
+ dexKey,
119
+ ContractMethod.swapExactAmountIn,
120
+ network,
121
+ provider,
122
+ );
123
+ });
124
+ it('SushiSwap TOKEN -> ETH', async () => {
125
+ await testE2E(
126
+ tokens.WETH,
127
+ tokens.XDAI,
128
+ holders.WETH,
129
+ '700000000000000000',
130
+ SwapSide.SELL,
131
+ dexKey,
132
+ ContractMethod.swapExactAmountIn,
133
+ network,
134
+ provider,
135
+ );
136
+ });
137
+ it('SushiSwap TOKEN -> TOKEN', async () => {
138
+ await testE2E(
139
+ tokens.WETH,
140
+ tokens.USDC,
141
+ holders.WETH,
142
+ '7000000000000000',
143
+ SwapSide.SELL,
144
+ dexKey,
145
+ ContractMethod.swapExactAmountIn,
146
+ network,
147
+ provider,
148
+ );
149
+ });
150
+ });
151
+
152
+ describe('swapExactAmountOut', () => {
153
+ it('SushiSwap ETH -> TOKEN', async () => {
154
+ await testE2E(
155
+ tokens.XDAI,
156
+ tokens.USDC,
157
+ holders.XDAI,
158
+ '700000000',
159
+ SwapSide.BUY,
160
+ dexKey,
161
+ ContractMethod.swapExactAmountOut,
162
+ network,
163
+ provider,
164
+ );
165
+ });
166
+ it('SushiSwap TOKEN -> ETH', async () => {
167
+ await testE2E(
168
+ tokens.USDC,
169
+ tokens.XDAI,
170
+ holders.USDC,
171
+ '7000000000000000000',
172
+ SwapSide.BUY,
173
+ dexKey,
174
+ ContractMethod.swapExactAmountOut,
175
+ network,
176
+ provider,
177
+ );
178
+ });
179
+ it('SushiSwap TOKEN -> TOKEN', async () => {
180
+ await testE2E(
181
+ tokens.USDC,
182
+ tokens.WETH,
183
+ holders.USDC,
184
+ '700000000000000',
185
+ SwapSide.BUY,
186
+ dexKey,
187
+ ContractMethod.swapExactAmountOut,
188
+ network,
189
+ provider,
190
+ );
191
+ });
192
+ });
193
+ });
194
+
195
+ describe('SwaprV2', () => {
196
+ const dexKey = 'SwaprV2';
197
+
198
+ describe('swapExactAmountIn', () => {
199
+ it('SushiSwap ETH -> TOKEN', async () => {
200
+ await testE2E(
201
+ tokens.XDAI,
202
+ tokens.USDC,
203
+ holders.XDAI,
204
+ '700000000000000000',
205
+ SwapSide.SELL,
206
+ dexKey,
207
+ ContractMethod.swapExactAmountIn,
208
+ network,
209
+ provider,
210
+ );
211
+ });
212
+ it('SwaprV2 TOKEN -> ETH', async () => {
213
+ await testE2E(
214
+ tokens.WETH,
215
+ tokens.XDAI,
216
+ holders.WETH,
217
+ '700000000000000000',
218
+ SwapSide.SELL,
219
+ dexKey,
220
+ ContractMethod.swapExactAmountIn,
221
+ network,
222
+ provider,
223
+ );
224
+ });
225
+ it('SwaprV2 TOKEN -> TOKEN', async () => {
226
+ await testE2E(
227
+ tokens.WETH,
228
+ tokens.USDC,
229
+ holders.WETH,
230
+ '7000000000000000',
231
+ SwapSide.SELL,
232
+ dexKey,
233
+ ContractMethod.swapExactAmountIn,
234
+ network,
235
+ provider,
236
+ );
237
+ });
238
+ });
239
+
240
+ describe('swapExactAmountOut', () => {
241
+ it('SwaprV2 ETH -> TOKEN', async () => {
242
+ await testE2E(
243
+ tokens.XDAI,
244
+ // SWPR/WXDAI pool has non-standard feeCode - 100
245
+ tokens.SWPR,
246
+ holders.XDAI,
247
+ '7000000000000000000',
248
+ SwapSide.BUY,
249
+ dexKey,
250
+ ContractMethod.swapExactAmountOut,
251
+ network,
252
+ provider,
253
+ );
254
+ });
255
+ it('SwaprV2 TOKEN -> ETH', async () => {
256
+ await testE2E(
257
+ tokens.USDC,
258
+ tokens.XDAI,
259
+ holders.USDC,
260
+ '7000000000000000000',
261
+ SwapSide.BUY,
262
+ dexKey,
263
+ ContractMethod.swapExactAmountOut,
264
+ network,
265
+ provider,
266
+ );
267
+ });
268
+ it('SwaprV2 TOKEN -> TOKEN', async () => {
269
+ await testE2E(
270
+ tokens.USDC,
271
+ tokens.WETH,
272
+ holders.USDC,
273
+ '700000000000000',
274
+ SwapSide.BUY,
275
+ dexKey,
276
+ ContractMethod.swapExactAmountOut,
277
+ network,
278
+ provider,
279
+ );
280
+ });
281
+ });
282
+ });
283
+ });
@@ -681,7 +681,7 @@ export class UniswapV2
681
681
  }
682
682
 
683
683
  getAdapters(side: SwapSide): { name: string; index: number }[] | null {
684
- return this.adapters[side];
684
+ return this.adapters?.[side] ?? null;
685
685
  }
686
686
 
687
687
  async getTopPoolsForToken(
@@ -346,6 +346,20 @@ export const UniswapV3Config: DexConfigMap<DexParams> = {
346
346
  subgraphURL: 'https://api.studio.thegraph.com/query/59130/v3alb/0.3',
347
347
  },
348
348
  },
349
+ OkuTradeV3: {
350
+ [Network.GNOSIS]: {
351
+ factory: '0xe32f7dd7e3f098d518ff19a22d5f028e076489b1',
352
+ quoter: '0x7E9cB3499A6cee3baBe5c8a3D328EA7FD36578f4',
353
+ router: '0xB5253c895361678FF5D0fFDdA81Dd02f1F7a81D6',
354
+ supportedFees: SUPPORTED_FEES,
355
+ stateMulticall: '0x35Db9Ac2ff3C5A86fde165Bd26D43d303417942E',
356
+ uniswapMulticall: '0x4dfa9a980efE4802E969AC33968E3d6E59B8a19e',
357
+ chunksCount: 10,
358
+ initRetryFrequency: 10,
359
+ initHash: `0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54`,
360
+ subgraphURL: 'Dimv1udMsJu1DqirVM4G2vNRvH8CWzWTn7GffQQCGAaq',
361
+ },
362
+ },
349
363
  VelodromeSlipstream: {
350
364
  [Network.OPTIMISM]: {
351
365
  factory: '0x548118C7E0B865C2CfA94D15EC86B666468ac758',
@@ -1364,4 +1364,28 @@ describe('UniswapV3 E2E', () => {
1364
1364
  });
1365
1365
  });
1366
1366
  });
1367
+
1368
+ describe('OkuTradeV3 E2E', () => {
1369
+ const dexKey = 'OkuTradeV3';
1370
+ describe('Gnosis', () => {
1371
+ const network = Network.GNOSIS;
1372
+
1373
+ const tokenASymbol: string = 'WETH';
1374
+ const tokenBSymbol: string = 'sDAI';
1375
+
1376
+ const tokenAAmount: string = '1000000000000000000';
1377
+ const tokenBAmount: string = '1000000000000000000';
1378
+ const nativeTokenAmount = '1000000000000000000';
1379
+
1380
+ testForNetwork(
1381
+ network,
1382
+ dexKey,
1383
+ tokenASymbol,
1384
+ tokenBSymbol,
1385
+ tokenAAmount,
1386
+ tokenBAmount,
1387
+ nativeTokenAmount,
1388
+ );
1389
+ });
1390
+ });
1367
1391
  });
@@ -115,6 +115,7 @@ export class UniswapV3
115
115
  'BaseswapV3',
116
116
  'PharaohV2',
117
117
  'AlienBaseV3',
118
+ 'OkuTradeV3',
118
119
  ]),
119
120
  );
120
121
 
@@ -46,6 +46,11 @@ export const WethConfig: DexConfigMap<DexParams> = {
46
46
  poolGasCost: WethGasCost,
47
47
  },
48
48
  },
49
+ Wxdai: {
50
+ [Network.GNOSIS]: {
51
+ poolGasCost: WethGasCost,
52
+ },
53
+ },
49
54
  };
50
55
 
51
56
  export const Adapters: {
@@ -25,4 +25,12 @@ export const WUSDMConfig: DexConfigMap<WusdmParams> = {
25
25
  USDMAddress: '0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C',
26
26
  },
27
27
  },
28
+ // not really wUSDM, but works in the same way
29
+ // might give 1wei difference on BUY
30
+ sDAI: {
31
+ [Network.GNOSIS]: {
32
+ wUSDMAddress: '0xaf204776c7245bF4147c2612BF6e5972Ee483701', // sDAI
33
+ USDMAddress: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d', // WXDAI
34
+ },
35
+ },
28
36
  };
@@ -163,4 +163,42 @@ describe('MountainProtocol E2E', () => {
163
163
  tokenBAmount,
164
164
  );
165
165
  });
166
+
167
+ describe('Gnosis', () => {
168
+ const network = Network.GNOSIS;
169
+
170
+ const tokenASymbol: string = 'sDAI';
171
+ const tokenBSymbol: string = 'WXDAI';
172
+
173
+ const tokenAAmount: string = '500000000000000000';
174
+ const tokenBAmount: string = '500000000000000000';
175
+
176
+ testForNetwork(
177
+ network,
178
+ 'sDAI',
179
+ tokenASymbol,
180
+ tokenBSymbol,
181
+ tokenAAmount,
182
+ tokenBAmount,
183
+ );
184
+ });
185
+
186
+ describe('Gnosis with Native', () => {
187
+ const network = Network.GNOSIS;
188
+
189
+ const tokenASymbol: string = 'sDAI';
190
+ const tokenBSymbol: string = 'XDAI';
191
+
192
+ const tokenAAmount: string = '500000000000000000';
193
+ const tokenBAmount: string = '500000000000000000';
194
+
195
+ testForNetwork(
196
+ network,
197
+ 'sDAI',
198
+ tokenASymbol,
199
+ tokenBSymbol,
200
+ tokenAAmount,
201
+ tokenBAmount,
202
+ );
203
+ });
166
204
  });
@@ -38,6 +38,7 @@ export class WUSDM
38
38
  {
39
39
  readonly hasConstantPriceLargeAmounts = true;
40
40
  readonly isFeeOnTransferSupported = false;
41
+ readonly needWrapNative: boolean = true;
41
42
 
42
43
  public static dexKeysWithNetwork: { key: string; networks: Network[] }[] =
43
44
  getDexKeysWithNetwork(WUSDMConfig);
@@ -89,7 +90,10 @@ export class WUSDM
89
90
  side: SwapSide,
90
91
  blockNumber: number,
91
92
  ): Promise<string[]> {
92
- return this.isAppropriatePair(srcToken, destToken)
93
+ const _srcToken = this.dexHelper.config.wrapETH(srcToken);
94
+ const _destToken = this.dexHelper.config.wrapETH(destToken);
95
+
96
+ return this.isAppropriatePair(_srcToken, _destToken)
93
97
  ? [`${this.dexKey}_${this.wUSDMAddress}`]
94
98
  : [];
95
99
  }
@@ -121,13 +125,16 @@ export class WUSDM
121
125
  blockNumber: number,
122
126
  limitPools?: string[],
123
127
  ): Promise<null | ExchangePrices<WUSDMData>> {
124
- if (!this.isAppropriatePair(srcToken, destToken)) return null;
128
+ const _srcToken = this.dexHelper.config.wrapETH(srcToken);
129
+ const _destToken = this.dexHelper.config.wrapETH(destToken);
130
+
131
+ if (!this.isAppropriatePair(_srcToken, _destToken)) return null;
125
132
  const state = this.eventPool.getState(blockNumber);
126
133
  if (!state) return null;
127
134
 
128
- const isSrcAsset = this.isUSDM(srcToken.address);
135
+ const isSrcAsset = this.isUSDM(_srcToken.address);
129
136
 
130
- const isWrap = this.isWrap(srcToken, destToken, side);
137
+ const isWrap = this.isWrap(_srcToken, _destToken, side);
131
138
 
132
139
  let calcFunction: Function;
133
140
 
@@ -1,9 +1,9 @@
1
1
  import { DexExchangeBuildParam } from '../types';
2
- import { OptimalRate, SwapSide } from '@paraswap/core';
2
+ import { OptimalRate } from '@paraswap/core';
3
3
  import { isETHAddress } from '../utils';
4
4
  import { DepositWithdrawReturn } from '../dex/weth/types';
5
5
  import { WethConfig } from '../dex/weth/config';
6
- import { Executors, Flag, SpecialDex } from './types';
6
+ import { Executors } from './types';
7
7
  import { ExecutorBytecodeBuilder } from './ExecutorBytecodeBuilder';
8
8
  import { Network } from '../constants';
9
9
 
@@ -15,6 +15,7 @@ const SUPPORTED_NETWORKS = [
15
15
  Network.POLYGON,
16
16
  Network.OPTIMISM,
17
17
  Network.ZKEVM,
18
+ Network.GNOSIS,
18
19
  ];
19
20
  const SUPPORTED_EXCHANGES = Object.keys(WethConfig);
20
21