@paraswap/dex-lib 2.41.4 → 2.42.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 (225) hide show
  1. package/.idea/aws.xml +17 -0
  2. package/.idea/codeStyles/Project.xml +19 -0
  3. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  4. package/.idea/misc.xml +6 -0
  5. package/.idea/modules.xml +8 -0
  6. package/.idea/paraswap-dex-lib.iml +9 -0
  7. package/.idea/vcs.xml +6 -0
  8. package/build/abi/algebra/AlgebraPool.abi.json +727 -0
  9. package/build/abi/curve-v1/StableSwapFRXETH.json +889 -0
  10. package/build/abi/curve-v1/StableSwapWBETH.json +1223 -0
  11. package/build/abi/polygon-migration/PolygonMigration.abi.json +364 -0
  12. package/build/abi/sushiswap-v3/QuoterV2.json +267 -0
  13. package/build/abi/sushiswap-v3/RouterProcessor3.json +289 -0
  14. package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +193 -0
  15. package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3QuoterV2.abi.json +285 -0
  16. package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3Router.abi.json +583 -0
  17. package/build/abi/wBETH.json +1527 -0
  18. package/build/abi/woo-fi/WooFeeManager.abi.json +318 -0
  19. package/build/abi/woo-fi/WooPP.abi.json +548 -0
  20. package/build/abi/woo-fi/Wooracle.abi.json +260 -0
  21. package/build/config.js +2 -2
  22. package/build/dex/aave-v3/tokens/arbitrum.json +50 -0
  23. package/build/dex/aave-v3/tokens/avalanche.json +74 -0
  24. package/build/dex/aave-v3/tokens/fantom.json +62 -0
  25. package/build/dex/aave-v3/tokens/optimism.json +50 -0
  26. package/build/dex/aave-v3/tokens/polygon.json +116 -0
  27. package/build/dex/algebra/algebra-pool.d.ts +46 -0
  28. package/build/dex/algebra/algebra-pool.js +336 -0
  29. package/build/dex/algebra/algebra-pool.js.map +1 -0
  30. package/build/dex/balancer-v2/LinearMath.d.ts +19 -0
  31. package/build/dex/balancer-v2/LinearMath.js +179 -0
  32. package/build/dex/balancer-v2/LinearMath.js.map +1 -0
  33. package/build/dex/balancer-v2/LinearPool.d.ts +47 -0
  34. package/build/dex/balancer-v2/LinearPool.js +324 -0
  35. package/build/dex/balancer-v2/LinearPool.js.map +1 -0
  36. package/build/dex/balancer-v2/PhantomStablePool.d.ts +47 -0
  37. package/build/dex/balancer-v2/PhantomStablePool.js +294 -0
  38. package/build/dex/balancer-v2/PhantomStablePool.js.map +1 -0
  39. package/build/dex/balancer-v2/StableMath.d.ts +9 -0
  40. package/build/dex/balancer-v2/StableMath.js +272 -0
  41. package/build/dex/balancer-v2/StableMath.js.map +1 -0
  42. package/build/dex/balancer-v2/balancer-v2-pool.d.ts +75 -0
  43. package/build/dex/balancer-v2/balancer-v2-pool.js +417 -0
  44. package/build/dex/balancer-v2/balancer-v2-pool.js.map +1 -0
  45. package/build/dex/curve-v1/pools/frxETHpool.d.ts +7 -0
  46. package/build/dex/curve-v1/pools/frxETHpool.js +27 -0
  47. package/build/dex/curve-v1/pools/frxETHpool.js.map +1 -0
  48. package/build/dex/curve-v1/pools/wbETHpool.d.ts +29 -0
  49. package/build/dex/curve-v1/pools/wbETHpool.js +408 -0
  50. package/build/dex/curve-v1/pools/wbETHpool.js.map +1 -0
  51. package/build/dex/index.js +2 -0
  52. package/build/dex/index.js.map +1 -1
  53. package/build/dex/lighter-v1/abi/erc20.json +222 -0
  54. package/build/dex/lighter-v1/abi/factory.json +291 -0
  55. package/build/dex/lighter-v1/abi/order_book.json +594 -0
  56. package/build/dex/lighter-v1/abi/order_book_helper.json +176 -0
  57. package/build/dex/lighter-v1/abi/router.json +488 -0
  58. package/build/dex/{my-test-dex → lighter-v1}/config.d.ts +1 -1
  59. package/build/dex/lighter-v1/config.js +17 -0
  60. package/build/dex/lighter-v1/config.js.map +1 -0
  61. package/build/dex/lighter-v1/constants.d.ts +2 -0
  62. package/build/dex/lighter-v1/constants.js +13 -0
  63. package/build/dex/lighter-v1/constants.js.map +1 -0
  64. package/build/dex/{my-test-dex/my-test-dex-pool.d.ts → lighter-v1/lighter-v1-pool.d.ts} +24 -6
  65. package/build/dex/lighter-v1/lighter-v1-pool.js +310 -0
  66. package/build/dex/lighter-v1/lighter-v1-pool.js.map +1 -0
  67. package/build/dex/{my-test-dex/my-test-dex.d.ts → lighter-v1/lighter-v1.d.ts} +18 -10
  68. package/build/dex/lighter-v1/lighter-v1.js +331 -0
  69. package/build/dex/lighter-v1/lighter-v1.js.map +1 -0
  70. package/build/dex/lighter-v1/types.d.ts +40 -0
  71. package/build/dex/{my-test-dex → lighter-v1}/types.js.map +1 -1
  72. package/build/dex/pancakeswap-v3/types.d.ts +14 -0
  73. package/build/dex/pancakeswap-v3/types.js.map +1 -0
  74. package/build/dex/polygon-migrator/config.d.ts +11 -0
  75. package/build/dex/polygon-migrator/config.js +21 -0
  76. package/build/dex/polygon-migrator/config.js.map +1 -0
  77. package/build/dex/polygon-migrator/constants.d.ts +1 -0
  78. package/build/dex/polygon-migrator/constants.js +5 -0
  79. package/build/dex/polygon-migrator/constants.js.map +1 -0
  80. package/build/dex/polygon-migrator/polygon-migrator.d.ts +48 -0
  81. package/build/dex/polygon-migrator/polygon-migrator.js +109 -0
  82. package/build/dex/polygon-migrator/polygon-migrator.js.map +1 -0
  83. package/build/dex/polygon-migrator/types.d.ts +11 -0
  84. package/build/dex/polygon-migrator/types.js +9 -0
  85. package/build/dex/polygon-migrator/types.js.map +1 -0
  86. package/build/dex/quickswap/camelot-v3.d.ts +6 -0
  87. package/build/dex/quickswap/camelot-v3.js +19 -0
  88. package/build/dex/quickswap/camelot-v3.js.map +1 -0
  89. package/build/dex/quickswap/zyberswap-v3.d.ts +6 -0
  90. package/build/dex/quickswap/zyberswap-v3.js +19 -0
  91. package/build/dex/quickswap/zyberswap-v3.js.map +1 -0
  92. package/build/dex/quickswap-v3.d.ts +21 -0
  93. package/build/dex/quickswap-v3.js +40 -0
  94. package/build/dex/quickswap-v3.js.map +1 -0
  95. package/build/dex/ramses-v2/config.d.ts +4 -0
  96. package/build/dex/ramses-v2/config.js +28 -0
  97. package/build/dex/ramses-v2/config.js.map +1 -0
  98. package/build/dex/ramses-v2/constants.d.ts +28 -0
  99. package/build/dex/ramses-v2/constants.js +35 -0
  100. package/build/dex/ramses-v2/constants.js.map +1 -0
  101. package/build/dex/ramses-v2/contract-math/BitMath.d.ts +4 -0
  102. package/build/dex/ramses-v2/contract-math/BitMath.js +93 -0
  103. package/build/dex/ramses-v2/contract-math/BitMath.js.map +1 -0
  104. package/build/dex/ramses-v2/contract-math/FixedPoint128.d.ts +3 -0
  105. package/build/dex/ramses-v2/contract-math/FixedPoint128.js +8 -0
  106. package/build/dex/ramses-v2/contract-math/FixedPoint128.js.map +1 -0
  107. package/build/dex/ramses-v2/contract-math/FixedPoint96.d.ts +4 -0
  108. package/build/dex/ramses-v2/contract-math/FixedPoint96.js +9 -0
  109. package/build/dex/ramses-v2/contract-math/FixedPoint96.js.map +1 -0
  110. package/build/dex/ramses-v2/contract-math/FullMath.d.ts +4 -0
  111. package/build/dex/ramses-v2/contract-math/FullMath.js +19 -0
  112. package/build/dex/ramses-v2/contract-math/FullMath.js.map +1 -0
  113. package/build/dex/ramses-v2/contract-math/LiquidityMath.d.ts +3 -0
  114. package/build/dex/ramses-v2/contract-math/LiquidityMath.js +22 -0
  115. package/build/dex/ramses-v2/contract-math/LiquidityMath.js.map +1 -0
  116. package/build/dex/ramses-v2/contract-math/Oracle.d.ts +10 -0
  117. package/build/dex/ramses-v2/contract-math/Oracle.js +133 -0
  118. package/build/dex/ramses-v2/contract-math/Oracle.js.map +1 -0
  119. package/build/dex/ramses-v2/contract-math/SqrtPriceMath.d.ts +10 -0
  120. package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js +91 -0
  121. package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js.map +1 -0
  122. package/build/dex/ramses-v2/contract-math/SwapMath.d.ts +8 -0
  123. package/build/dex/ramses-v2/contract-math/SwapMath.js +70 -0
  124. package/build/dex/ramses-v2/contract-math/SwapMath.js.map +1 -0
  125. package/build/dex/ramses-v2/contract-math/Tick.d.ts +7 -0
  126. package/build/dex/ramses-v2/contract-math/Tick.js +45 -0
  127. package/build/dex/ramses-v2/contract-math/Tick.js.map +1 -0
  128. package/build/dex/ramses-v2/contract-math/TickBitMap.d.ts +8 -0
  129. package/build/dex/ramses-v2/contract-math/TickBitMap.js +87 -0
  130. package/build/dex/ramses-v2/contract-math/TickBitMap.js.map +1 -0
  131. package/build/dex/ramses-v2/contract-math/TickMath.d.ts +8 -0
  132. package/build/dex/ramses-v2/contract-math/TickMath.js +162 -0
  133. package/build/dex/ramses-v2/contract-math/TickMath.js.map +1 -0
  134. package/build/dex/ramses-v2/contract-math/UnsafeMath.d.ts +3 -0
  135. package/build/dex/ramses-v2/contract-math/UnsafeMath.js +10 -0
  136. package/build/dex/ramses-v2/contract-math/UnsafeMath.js.map +1 -0
  137. package/build/dex/ramses-v2/contract-math/uniswap-v3-math.d.ts +18 -0
  138. package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js +392 -0
  139. package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js.map +1 -0
  140. package/build/dex/ramses-v2/contract-math/utils.d.ts +3 -0
  141. package/build/dex/ramses-v2/contract-math/utils.js +16 -0
  142. package/build/dex/ramses-v2/contract-math/utils.js.map +1 -0
  143. package/build/dex/ramses-v2/ramses-v2-pool.d.ts +42 -0
  144. package/build/dex/ramses-v2/ramses-v2-pool.js +307 -0
  145. package/build/dex/ramses-v2/ramses-v2-pool.js.map +1 -0
  146. package/build/dex/ramses-v2/ramses-v2.d.ts +61 -0
  147. package/build/dex/ramses-v2/ramses-v2.js +690 -0
  148. package/build/dex/ramses-v2/ramses-v2.js.map +1 -0
  149. package/build/dex/ramses-v2/types.d.ts +154 -0
  150. package/build/dex/ramses-v2/types.js +9 -0
  151. package/build/dex/ramses-v2/types.js.map +1 -0
  152. package/build/dex/ramses-v2/utils.d.ts +6 -0
  153. package/build/dex/ramses-v2/utils.js +71 -0
  154. package/build/dex/ramses-v2/utils.js.map +1 -0
  155. package/build/dex/sushiswap-v3/config.d.ts +4 -0
  156. package/build/dex/sushiswap-v3/config.js +132 -0
  157. package/build/dex/sushiswap-v3/config.js.map +1 -0
  158. package/build/dex/sushiswap-v3/constants.d.ts +4 -0
  159. package/build/dex/sushiswap-v3/constants.js +32 -0
  160. package/build/dex/sushiswap-v3/constants.js.map +1 -0
  161. package/build/dex/sushiswap-v3/sushiswap-v3-original.d.ts +56 -0
  162. package/build/dex/sushiswap-v3/sushiswap-v3-original.js +598 -0
  163. package/build/dex/sushiswap-v3/sushiswap-v3-original.js.map +1 -0
  164. package/build/dex/sushiswap-v3/sushiswap-v3-pool.d.ts +1 -0
  165. package/build/dex/sushiswap-v3/sushiswap-v3-pool.js +6 -0
  166. package/build/dex/sushiswap-v3/sushiswap-v3-pool.js.map +1 -0
  167. package/build/dex/sushiswap-v3/sushiswap-v3.d.ts +21 -0
  168. package/build/dex/sushiswap-v3/sushiswap-v3.js +58 -0
  169. package/build/dex/sushiswap-v3/sushiswap-v3.js.map +1 -0
  170. package/build/dex/sushiswap-v3/token.d.ts +6 -0
  171. package/build/dex/sushiswap-v3/token.js +23 -0
  172. package/build/dex/sushiswap-v3/token.js.map +1 -0
  173. package/build/dex/sushiswap-v3/types.d.ts +15 -0
  174. package/build/dex/sushiswap-v3/types.js +18 -0
  175. package/build/dex/sushiswap-v3/types.js.map +1 -0
  176. package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.d.ts +12 -0
  177. package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js +23 -0
  178. package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js.map +1 -0
  179. package/build/dex/{hello → woo-fi}/config.d.ts +1 -1
  180. package/build/dex/woo-fi/config.js +141 -0
  181. package/build/dex/woo-fi/config.js.map +1 -0
  182. package/build/dex/woo-fi/constants.d.ts +5 -0
  183. package/build/dex/woo-fi/constants.js +20 -0
  184. package/build/dex/woo-fi/constants.js.map +1 -0
  185. package/build/dex/woo-fi/types.d.ts +48 -0
  186. package/build/dex/woo-fi/types.js +3 -0
  187. package/build/dex/{hello → woo-fi}/types.js.map +1 -1
  188. package/build/dex/woo-fi/woo-fi-decimal-math.d.ts +14 -0
  189. package/build/dex/woo-fi/woo-fi-decimal-math.js +42 -0
  190. package/build/dex/woo-fi/woo-fi-decimal-math.js.map +1 -0
  191. package/build/dex/woo-fi/woo-fi-math.d.ts +31 -0
  192. package/build/dex/woo-fi/woo-fi-math.js +300 -0
  193. package/build/dex/woo-fi/woo-fi-math.js.map +1 -0
  194. package/build/dex/woo-fi/woo-fi.d.ts +65 -0
  195. package/build/dex/woo-fi/woo-fi.js +480 -0
  196. package/build/dex/woo-fi/woo-fi.js.map +1 -0
  197. package/package.json +1 -1
  198. package/src/abi/polygon-migration/PolygonMigration.abi.json +364 -0
  199. package/src/config.ts +2 -2
  200. package/src/dex/index.ts +2 -0
  201. package/src/dex/polygon-migrator/config.ts +25 -0
  202. package/src/dex/polygon-migrator/constants.ts +2 -0
  203. package/src/dex/polygon-migrator/polygon-migrator-e2e.test.ts +102 -0
  204. package/src/dex/polygon-migrator/polygon-migrator-integration.test.ts +140 -0
  205. package/src/dex/polygon-migrator/polygon-migrator.ts +151 -0
  206. package/src/dex/polygon-migrator/types.ts +14 -0
  207. package/tests/constants-e2e.ts +10 -0
  208. package/build/dex/hello/config.js +0 -15
  209. package/build/dex/hello/config.js.map +0 -1
  210. package/build/dex/hello/hello-pool.d.ts +0 -39
  211. package/build/dex/hello/hello-pool.js +0 -64
  212. package/build/dex/hello/hello-pool.js.map +0 -1
  213. package/build/dex/hello/hello.d.ts +0 -37
  214. package/build/dex/hello/hello.js +0 -126
  215. package/build/dex/hello/hello.js.map +0 -1
  216. package/build/dex/hello/types.d.ts +0 -6
  217. package/build/dex/my-test-dex/config.js +0 -15
  218. package/build/dex/my-test-dex/config.js.map +0 -1
  219. package/build/dex/my-test-dex/my-test-dex-pool.js +0 -64
  220. package/build/dex/my-test-dex/my-test-dex-pool.js.map +0 -1
  221. package/build/dex/my-test-dex/my-test-dex.js +0 -126
  222. package/build/dex/my-test-dex/my-test-dex.js.map +0 -1
  223. package/build/dex/my-test-dex/types.d.ts +0 -6
  224. /package/build/dex/{hello → lighter-v1}/types.js +0 -0
  225. /package/build/dex/{my-test-dex → pancakeswap-v3}/types.js +0 -0
@@ -0,0 +1,364 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ {
5
+ "internalType": "address",
6
+ "name": "matic_",
7
+ "type": "address"
8
+ }
9
+ ],
10
+ "stateMutability": "nonpayable",
11
+ "type": "constructor"
12
+ },
13
+ {
14
+ "inputs": [],
15
+ "name": "InvalidAddress",
16
+ "type": "error"
17
+ },
18
+ {
19
+ "inputs": [],
20
+ "name": "InvalidAddressOrAlreadySet",
21
+ "type": "error"
22
+ },
23
+ {
24
+ "inputs": [],
25
+ "name": "UnmigrationLocked",
26
+ "type": "error"
27
+ },
28
+ {
29
+ "anonymous": false,
30
+ "inputs": [
31
+ {
32
+ "indexed": false,
33
+ "internalType": "uint8",
34
+ "name": "version",
35
+ "type": "uint8"
36
+ }
37
+ ],
38
+ "name": "Initialized",
39
+ "type": "event"
40
+ },
41
+ {
42
+ "anonymous": false,
43
+ "inputs": [
44
+ {
45
+ "indexed": true,
46
+ "internalType": "address",
47
+ "name": "account",
48
+ "type": "address"
49
+ },
50
+ {
51
+ "indexed": false,
52
+ "internalType": "uint256",
53
+ "name": "amount",
54
+ "type": "uint256"
55
+ }
56
+ ],
57
+ "name": "Migrated",
58
+ "type": "event"
59
+ },
60
+ {
61
+ "anonymous": false,
62
+ "inputs": [
63
+ {
64
+ "indexed": true,
65
+ "internalType": "address",
66
+ "name": "previousOwner",
67
+ "type": "address"
68
+ },
69
+ {
70
+ "indexed": true,
71
+ "internalType": "address",
72
+ "name": "newOwner",
73
+ "type": "address"
74
+ }
75
+ ],
76
+ "name": "OwnershipTransferStarted",
77
+ "type": "event"
78
+ },
79
+ {
80
+ "anonymous": false,
81
+ "inputs": [
82
+ {
83
+ "indexed": true,
84
+ "internalType": "address",
85
+ "name": "previousOwner",
86
+ "type": "address"
87
+ },
88
+ {
89
+ "indexed": true,
90
+ "internalType": "address",
91
+ "name": "newOwner",
92
+ "type": "address"
93
+ }
94
+ ],
95
+ "name": "OwnershipTransferred",
96
+ "type": "event"
97
+ },
98
+ {
99
+ "anonymous": false,
100
+ "inputs": [
101
+ {
102
+ "indexed": true,
103
+ "internalType": "address",
104
+ "name": "account",
105
+ "type": "address"
106
+ },
107
+ {
108
+ "indexed": true,
109
+ "internalType": "address",
110
+ "name": "recipient",
111
+ "type": "address"
112
+ },
113
+ {
114
+ "indexed": false,
115
+ "internalType": "uint256",
116
+ "name": "amount",
117
+ "type": "uint256"
118
+ }
119
+ ],
120
+ "name": "Unmigrated",
121
+ "type": "event"
122
+ },
123
+ {
124
+ "anonymous": false,
125
+ "inputs": [
126
+ {
127
+ "indexed": false,
128
+ "internalType": "bool",
129
+ "name": "lock",
130
+ "type": "bool"
131
+ }
132
+ ],
133
+ "name": "UnmigrationLockUpdated",
134
+ "type": "event"
135
+ },
136
+ {
137
+ "inputs": [],
138
+ "name": "acceptOwnership",
139
+ "outputs": [],
140
+ "stateMutability": "nonpayable",
141
+ "type": "function"
142
+ },
143
+ {
144
+ "inputs": [
145
+ {
146
+ "internalType": "uint256",
147
+ "name": "amount",
148
+ "type": "uint256"
149
+ }
150
+ ],
151
+ "name": "burn",
152
+ "outputs": [],
153
+ "stateMutability": "nonpayable",
154
+ "type": "function"
155
+ },
156
+ {
157
+ "inputs": [],
158
+ "name": "initialize",
159
+ "outputs": [],
160
+ "stateMutability": "nonpayable",
161
+ "type": "function"
162
+ },
163
+ {
164
+ "inputs": [],
165
+ "name": "matic",
166
+ "outputs": [
167
+ {
168
+ "internalType": "contract IERC20",
169
+ "name": "",
170
+ "type": "address"
171
+ }
172
+ ],
173
+ "stateMutability": "view",
174
+ "type": "function"
175
+ },
176
+ {
177
+ "inputs": [
178
+ {
179
+ "internalType": "uint256",
180
+ "name": "amount",
181
+ "type": "uint256"
182
+ }
183
+ ],
184
+ "name": "migrate",
185
+ "outputs": [],
186
+ "stateMutability": "nonpayable",
187
+ "type": "function"
188
+ },
189
+ {
190
+ "inputs": [],
191
+ "name": "owner",
192
+ "outputs": [
193
+ {
194
+ "internalType": "address",
195
+ "name": "",
196
+ "type": "address"
197
+ }
198
+ ],
199
+ "stateMutability": "view",
200
+ "type": "function"
201
+ },
202
+ {
203
+ "inputs": [],
204
+ "name": "pendingOwner",
205
+ "outputs": [
206
+ {
207
+ "internalType": "address",
208
+ "name": "",
209
+ "type": "address"
210
+ }
211
+ ],
212
+ "stateMutability": "view",
213
+ "type": "function"
214
+ },
215
+ {
216
+ "inputs": [],
217
+ "name": "polygon",
218
+ "outputs": [
219
+ {
220
+ "internalType": "contract IERC20",
221
+ "name": "",
222
+ "type": "address"
223
+ }
224
+ ],
225
+ "stateMutability": "view",
226
+ "type": "function"
227
+ },
228
+ {
229
+ "inputs": [],
230
+ "name": "renounceOwnership",
231
+ "outputs": [],
232
+ "stateMutability": "nonpayable",
233
+ "type": "function"
234
+ },
235
+ {
236
+ "inputs": [
237
+ {
238
+ "internalType": "address",
239
+ "name": "polygon_",
240
+ "type": "address"
241
+ }
242
+ ],
243
+ "name": "setPolygonToken",
244
+ "outputs": [],
245
+ "stateMutability": "nonpayable",
246
+ "type": "function"
247
+ },
248
+ {
249
+ "inputs": [
250
+ {
251
+ "internalType": "address",
252
+ "name": "newOwner",
253
+ "type": "address"
254
+ }
255
+ ],
256
+ "name": "transferOwnership",
257
+ "outputs": [],
258
+ "stateMutability": "nonpayable",
259
+ "type": "function"
260
+ },
261
+ {
262
+ "inputs": [
263
+ {
264
+ "internalType": "uint256",
265
+ "name": "amount",
266
+ "type": "uint256"
267
+ }
268
+ ],
269
+ "name": "unmigrate",
270
+ "outputs": [],
271
+ "stateMutability": "nonpayable",
272
+ "type": "function"
273
+ },
274
+ {
275
+ "inputs": [
276
+ {
277
+ "internalType": "address",
278
+ "name": "recipient",
279
+ "type": "address"
280
+ },
281
+ {
282
+ "internalType": "uint256",
283
+ "name": "amount",
284
+ "type": "uint256"
285
+ }
286
+ ],
287
+ "name": "unmigrateTo",
288
+ "outputs": [],
289
+ "stateMutability": "nonpayable",
290
+ "type": "function"
291
+ },
292
+ {
293
+ "inputs": [
294
+ {
295
+ "internalType": "uint256",
296
+ "name": "amount",
297
+ "type": "uint256"
298
+ },
299
+ {
300
+ "internalType": "uint256",
301
+ "name": "deadline",
302
+ "type": "uint256"
303
+ },
304
+ {
305
+ "internalType": "uint8",
306
+ "name": "v",
307
+ "type": "uint8"
308
+ },
309
+ {
310
+ "internalType": "bytes32",
311
+ "name": "r",
312
+ "type": "bytes32"
313
+ },
314
+ {
315
+ "internalType": "bytes32",
316
+ "name": "s",
317
+ "type": "bytes32"
318
+ }
319
+ ],
320
+ "name": "unmigrateWithPermit",
321
+ "outputs": [],
322
+ "stateMutability": "nonpayable",
323
+ "type": "function"
324
+ },
325
+ {
326
+ "inputs": [],
327
+ "name": "unmigrationLocked",
328
+ "outputs": [
329
+ {
330
+ "internalType": "bool",
331
+ "name": "",
332
+ "type": "bool"
333
+ }
334
+ ],
335
+ "stateMutability": "view",
336
+ "type": "function"
337
+ },
338
+ {
339
+ "inputs": [
340
+ {
341
+ "internalType": "bool",
342
+ "name": "unmigrationLocked_",
343
+ "type": "bool"
344
+ }
345
+ ],
346
+ "name": "updateUnmigrationLock",
347
+ "outputs": [],
348
+ "stateMutability": "nonpayable",
349
+ "type": "function"
350
+ },
351
+ {
352
+ "inputs": [],
353
+ "name": "version",
354
+ "outputs": [
355
+ {
356
+ "internalType": "string",
357
+ "name": "",
358
+ "type": "string"
359
+ }
360
+ ],
361
+ "stateMutability": "pure",
362
+ "type": "function"
363
+ }
364
+ ]
package/src/config.ts CHANGED
@@ -52,8 +52,8 @@ const baseConfigs: { [network: number]: BaseConfig } = {
52
52
  Adapter01: '0x9bE264469eF954c139Da4A45Cf76CbCC5e3A6A73',
53
53
  Adapter02: '0xFC2Ba6E830a04C25e207B8214b26d8C713F6881F',
54
54
  Adapter03: '0xfb2a3de6c7B8c77b520E3da16021f3D8A4E93168',
55
- Adapter04: '0x30F6B9b6485ff0B67E881f5ac80D3F1c70A4B23d',
56
- BuyAdapter: '0x613876f3dE2Ec633f8054fE7a561324c1a01d9cB',
55
+ Adapter04: '0x1A23Aa6f7ff4215Fd2d220EA6f4a0DF45A77fc6C',
56
+ BuyAdapter: '0x1310dE2C69e9753bee19B5522bad39c5f788efd9',
57
57
  },
58
58
  uniswapV2ExchangeRouterAddress:
59
59
  '0xF9234CB08edb93c0d4a4d4c70cC3FfD070e78e07',
package/src/dex/index.ts CHANGED
@@ -5,6 +5,7 @@ import { Jarvis } from './jarvis';
5
5
  import { JarvisV6 } from './jarvis-v6/jarvis-v6';
6
6
  import { StablePool } from './stable-pool';
7
7
  import { Weth } from './weth/weth';
8
+ import { PolygonMigrator } from './polygon-migrator/polygon-migrator';
8
9
  import { ZeroX } from './zerox';
9
10
  import { UniswapV3 } from './uniswap-v3/uniswap-v3';
10
11
  import { BalancerV2 } from './balancer-v2/balancer-v2';
@@ -124,6 +125,7 @@ const Dexes = [
124
125
  AaveV3,
125
126
  KyberDmm,
126
127
  Weth,
128
+ PolygonMigrator,
127
129
  MakerPsm,
128
130
  Nerve,
129
131
  Platypus,
@@ -0,0 +1,25 @@
1
+ import { DexParams } from './types';
2
+ import { DexConfigMap } from '../../types';
3
+ import { Network } from '../../constants';
4
+ import { SwapSide } from '@paraswap/core';
5
+
6
+ export const PolygonMigratorConfig: DexConfigMap<DexParams> = {
7
+ PolygonMigrator: {
8
+ [Network.MAINNET]: {
9
+ migratorAddress: '0x29e7df7b6a1b2b07b731457f499e1696c60e2c4e',
10
+ polTokenAddress: '0x455e53CBB86018Ac2B8092FdCd39d8444aFFC3F6',
11
+ maticTokenAddress: '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0'
12
+ },
13
+ },
14
+ };
15
+
16
+ export const Adapters: {
17
+ [chainId: number]: {
18
+ [side: string]: { name: string; index: number }[];
19
+ };
20
+ } = {
21
+ [Network.MAINNET]: {
22
+ [SwapSide.SELL]: [{ name: 'Adapter04', index: 4 }],
23
+ [SwapSide.BUY]: [{ name: 'BuyAdapter', index: 11 }],
24
+ },
25
+ };
@@ -0,0 +1,2 @@
1
+
2
+ export const POLYGON_MIGRATION_GAS_COST= 90_000;
@@ -0,0 +1,102 @@
1
+ import dotenv from 'dotenv';
2
+ dotenv.config();
3
+
4
+ import { ContractMethod, Network, SwapSide } from '../../constants';
5
+ import { StaticJsonRpcProvider } from '@ethersproject/providers';
6
+ import { generateConfig } from '../../config';
7
+ import { Holders, Tokens } from '../../../tests/constants-e2e';
8
+ import { testE2E } from '../../../tests/utils-e2e';
9
+
10
+ function testForNetwork(
11
+ network: Network,
12
+ dexKey: string,
13
+ tokenASymbol: string,
14
+ tokenBSymbol: string,
15
+ tokenAAmount: string,
16
+ tokenBAmount: string,
17
+ ) {
18
+ const provider = new StaticJsonRpcProvider(
19
+ generateConfig(network).privateHttpProvider,
20
+ network,
21
+ );
22
+ const tokens = Tokens[network];
23
+ const holders = Holders[network];
24
+
25
+ const sideToContractMethods = new Map([
26
+ [
27
+ SwapSide.SELL,
28
+ [
29
+ ContractMethod.simpleSwap,
30
+ ContractMethod.multiSwap,
31
+ ContractMethod.megaSwap,
32
+ ],
33
+ ],
34
+ [
35
+ SwapSide.BUY,
36
+ [
37
+ ContractMethod.simpleBuy,
38
+ ContractMethod.buy,
39
+ ],
40
+ ],
41
+ ]);
42
+
43
+ describe(`${network}`, () => {
44
+ sideToContractMethods.forEach((contractMethods, side) =>
45
+ describe(`${side}`, () => {
46
+ contractMethods.forEach((contractMethod: ContractMethod) => {
47
+ describe(`${contractMethod}`, () => {
48
+ it(`${tokenASymbol} -> ${tokenBSymbol}`, async () => {
49
+ await testE2E(
50
+ tokens[tokenASymbol],
51
+ tokens[tokenBSymbol],
52
+ holders[tokenASymbol],
53
+ side === SwapSide.SELL ? tokenAAmount : tokenBAmount,
54
+ side,
55
+ dexKey,
56
+ contractMethod,
57
+ network,
58
+ provider,
59
+ );
60
+ });
61
+ it(`${tokenBSymbol} -> ${tokenASymbol}`, async () => {
62
+ await testE2E(
63
+ tokens[tokenBSymbol],
64
+ tokens[tokenASymbol],
65
+ holders[tokenBSymbol],
66
+ side === SwapSide.SELL ? tokenBAmount : tokenAAmount,
67
+ side,
68
+ dexKey,
69
+ contractMethod,
70
+ network,
71
+ provider,
72
+ );
73
+ });
74
+ });
75
+ });
76
+ }),
77
+ );
78
+ });
79
+ }
80
+
81
+ describe('PolygonMigrator E2E', () => {
82
+ const dexKey = 'PolygonMigrator';
83
+
84
+ describe('Mainnet', () => {
85
+ const network = Network.MAINNET;
86
+
87
+ const tokenASymbol: string = 'POL';
88
+ const tokenBSymbol: string = 'MATIC';
89
+
90
+ const tokenAAmount: string = '10000000000000000000';
91
+ const tokenBAmount: string = '20000000000000000000000';
92
+
93
+ testForNetwork(
94
+ network,
95
+ dexKey,
96
+ tokenASymbol,
97
+ tokenBSymbol,
98
+ tokenAAmount,
99
+ tokenBAmount,
100
+ );
101
+ });
102
+ });
@@ -0,0 +1,140 @@
1
+ import dotenv from 'dotenv';
2
+ dotenv.config();
3
+
4
+ import { DummyDexHelper } from '../../dex-helper/index';
5
+ import { Network, SwapSide } from '../../constants';
6
+ import { checkConstantPoolPrices } from '../../../tests/utils';
7
+ import { Tokens } from '../../../tests/constants-e2e';
8
+ import { BI_POWS } from '../../bigint-constants';
9
+ import { PolygonMigrator } from './polygon-migrator';
10
+
11
+ const network = Network.MAINNET;
12
+
13
+ const MaticSymbol = 'MATIC';
14
+ const MaticToken = Tokens[network][MaticSymbol];
15
+
16
+ const PolSymbol = 'POL';
17
+ const PolToken = Tokens[network][PolSymbol];
18
+
19
+ const amounts = [0n, BI_POWS[18], 2000000000000000000n];
20
+
21
+ const dexKey = 'PolygonMigrator';
22
+
23
+ describe('PolygonMigrator', function () {
24
+ it('getPoolIdentifiers and getPricesVolume MATIC -> POL SELL', async function () {
25
+ const dexHelper = new DummyDexHelper(network);
26
+ const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
27
+ const polygonMigrator = new PolygonMigrator(network, dexKey, dexHelper);
28
+
29
+ const pools = await polygonMigrator.getPoolIdentifiers(
30
+ MaticToken,
31
+ PolToken,
32
+ SwapSide.SELL,
33
+ blocknumber,
34
+ );
35
+ console.log(`${MaticSymbol} <> ${PolSymbol} Pool Identifiers: `, pools);
36
+
37
+ expect(pools.length).toBeGreaterThan(0);
38
+
39
+ const poolPrices = await polygonMigrator.getPricesVolume(
40
+ MaticToken,
41
+ PolToken,
42
+ amounts,
43
+ SwapSide.SELL,
44
+ blocknumber,
45
+ pools,
46
+ );
47
+ console.log(`${MaticSymbol} <> ${PolSymbol} Pool Prices: `, poolPrices);
48
+
49
+ expect(poolPrices).not.toBeNull();
50
+ checkConstantPoolPrices(poolPrices!, amounts, dexKey);
51
+ });
52
+
53
+ it('getPoolIdentifiers and getPricesVolume POL -> MATIC SELL', async function () {
54
+ const dexHelper = new DummyDexHelper(network);
55
+ const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
56
+ const polygonMigrator = new PolygonMigrator(network, dexKey, dexHelper);
57
+
58
+ const pools = await polygonMigrator.getPoolIdentifiers(
59
+ PolToken,
60
+ MaticToken,
61
+ SwapSide.SELL,
62
+ blocknumber,
63
+ );
64
+ console.log(`${PolSymbol} <> ${MaticSymbol} Pool Identifiers: `, pools);
65
+
66
+ expect(pools.length).toBeGreaterThan(0);
67
+
68
+ const poolPrices = await polygonMigrator.getPricesVolume(
69
+ PolToken,
70
+ MaticToken,
71
+ amounts,
72
+ SwapSide.SELL,
73
+ blocknumber,
74
+ pools,
75
+ );
76
+ console.log(`${PolSymbol} <> ${MaticSymbol} Pool Prices: `, poolPrices);
77
+
78
+ expect(poolPrices).not.toBeNull();
79
+ checkConstantPoolPrices(poolPrices!, amounts, dexKey);
80
+ });
81
+
82
+ it('getPoolIdentifiers and getPricesVolume MATIC -> POL BUY', async function () {
83
+ const dexHelper = new DummyDexHelper(network);
84
+ const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
85
+ const polygonMigrator = new PolygonMigrator(network, dexKey, dexHelper);
86
+
87
+ const pools = await polygonMigrator.getPoolIdentifiers(
88
+ MaticToken,
89
+ PolToken,
90
+ SwapSide.BUY,
91
+ blocknumber,
92
+ );
93
+ console.log(`${MaticSymbol} <> ${PolSymbol} Pool Identifiers: `, pools);
94
+
95
+ expect(pools.length).toBeGreaterThan(0);
96
+
97
+ const poolPrices = await polygonMigrator.getPricesVolume(
98
+ MaticToken,
99
+ PolToken,
100
+ amounts,
101
+ SwapSide.BUY,
102
+ blocknumber,
103
+ pools,
104
+ );
105
+ console.log(`${MaticSymbol} <> ${PolSymbol} Pool Prices: `, poolPrices);
106
+
107
+ expect(poolPrices).not.toBeNull();
108
+ checkConstantPoolPrices(poolPrices!, amounts, dexKey);
109
+ });
110
+
111
+ it('getPoolIdentifiers and getPricesVolume POL -> MATIC BUY', async function () {
112
+ const dexHelper = new DummyDexHelper(network);
113
+ const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
114
+ const polygonMigrator = new PolygonMigrator(network, dexKey, dexHelper);
115
+
116
+ const pools = await polygonMigrator.getPoolIdentifiers(
117
+ PolToken,
118
+ MaticToken,
119
+ SwapSide.BUY,
120
+ blocknumber,
121
+ );
122
+ console.log(`${PolSymbol} <> ${MaticSymbol} Pool Identifiers: `, pools);
123
+
124
+ expect(pools.length).toBeGreaterThan(0);
125
+
126
+ const poolPrices = await polygonMigrator.getPricesVolume(
127
+ PolToken,
128
+ MaticToken,
129
+ amounts,
130
+ SwapSide.BUY,
131
+ blocknumber,
132
+ pools,
133
+ );
134
+ console.log(`${PolSymbol} <> ${MaticSymbol} Pool Prices: `, poolPrices);
135
+
136
+ expect(poolPrices).not.toBeNull();
137
+ checkConstantPoolPrices(poolPrices!, amounts, dexKey);
138
+ });
139
+
140
+ });