@instadapp/interop-x 0.0.0-dev.bfeca30 → 0.0.0-dev.c279cb8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. package/.github/workflows/ci.yml +19 -0
  2. package/dist/package.json +4 -2
  3. package/dist/src/abi/connectors/index.js +36 -0
  4. package/dist/src/abi/connectors/v1/aave.js +148 -0
  5. package/dist/src/abi/connectors/v1/aave_claim.js +4 -0
  6. package/dist/src/abi/connectors/v1/aave_migrate.js +109 -0
  7. package/dist/src/abi/connectors/v1/aave_polygon_migrate.js +110 -0
  8. package/dist/src/abi/connectors/v1/aave_stake.js +4 -0
  9. package/dist/src/abi/connectors/v1/aave_v1_import.js +54 -0
  10. package/dist/src/abi/connectors/v1/aave_v2.js +230 -0
  11. package/dist/src/abi/connectors/v1/aave_v2_import.js +59 -0
  12. package/dist/src/abi/connectors/v1/authority.js +100 -0
  13. package/dist/src/abi/connectors/v1/basic.js +136 -0
  14. package/dist/src/abi/connectors/v1/chi.js +36 -0
  15. package/dist/src/abi/connectors/v1/comp.js +4 -0
  16. package/dist/src/abi/connectors/v1/compound.js +4 -0
  17. package/dist/src/abi/connectors/v1/compoundImport.js +69 -0
  18. package/dist/src/abi/connectors/v1/compoundImport_v2.js +4 -0
  19. package/dist/src/abi/connectors/v1/compound_old.js +448 -0
  20. package/dist/src/abi/connectors/v1/curve.js +140 -0
  21. package/dist/src/abi/connectors/v1/curve_claim.js +63 -0
  22. package/dist/src/abi/connectors/v1/curve_gauge.js +158 -0
  23. package/dist/src/abi/connectors/v1/curve_sbtc.js +140 -0
  24. package/dist/src/abi/connectors/v1/curve_susd.js +140 -0
  25. package/dist/src/abi/connectors/v1/curve_three.js +79 -0
  26. package/dist/src/abi/connectors/v1/curve_y.js +140 -0
  27. package/dist/src/abi/connectors/v1/dsa_migrate_v1_to_v2.js +4 -0
  28. package/dist/src/abi/connectors/v1/dydx.js +148 -0
  29. package/dist/src/abi/connectors/v1/dydx_flash.js +52 -0
  30. package/dist/src/abi/connectors/v1/fee.js +50 -0
  31. package/dist/src/abi/connectors/v1/gelato.js +1138 -0
  32. package/dist/src/abi/connectors/v1/index.js +58 -0
  33. package/dist/src/abi/connectors/v1/instapool.js +439 -0
  34. package/dist/src/abi/connectors/v1/instapool_v2.js +126 -0
  35. package/dist/src/abi/connectors/v1/kyber.js +117 -0
  36. package/dist/src/abi/connectors/v1/maker.js +480 -0
  37. package/dist/src/abi/connectors/v1/maker_old.js +300 -0
  38. package/dist/src/abi/connectors/v1/math.js +43 -0
  39. package/dist/src/abi/connectors/v1/migrate.js +46 -0
  40. package/dist/src/abi/connectors/v1/oasis.js +198 -0
  41. package/dist/src/abi/connectors/v1/oneInch.js +160 -0
  42. package/dist/src/abi/connectors/v1/polygon_bridge.js +4 -0
  43. package/dist/src/abi/connectors/v1/refinance.js +4 -0
  44. package/dist/src/abi/connectors/v1/staking.js +220 -0
  45. package/dist/src/abi/connectors/v1/swerve.js +179 -0
  46. package/dist/src/abi/connectors/v1/uniswap.js +297 -0
  47. package/dist/src/abi/connectors/v2/1INCH-A.js +4 -0
  48. package/dist/src/abi/connectors/v2/1INCH-B.js +4 -0
  49. package/dist/src/abi/connectors/v2/AAVE-CLAIM-A.js +4 -0
  50. package/dist/src/abi/connectors/v2/AAVE-CLAIM-B.js +166 -0
  51. package/dist/src/abi/connectors/v2/AAVE-STAKE-A.js +4 -0
  52. package/dist/src/abi/connectors/v2/AAVE-V1-A.js +130 -0
  53. package/dist/src/abi/connectors/v2/AAVE-V1-IMPORT-A.js +4 -0
  54. package/dist/src/abi/connectors/v2/AAVE-V2-A.js +230 -0
  55. package/dist/src/abi/connectors/v2/AAVE-V2-IMPORT-A.js +4 -0
  56. package/dist/src/abi/connectors/v2/AAVE-V2-IMPORT-B.js +225 -0
  57. package/dist/src/abi/connectors/v2/AUTHORITY-A.js +100 -0
  58. package/dist/src/abi/connectors/v2/B-COMPOUND-A.js +4 -0
  59. package/dist/src/abi/connectors/v2/B-LIQUITY-A.js +4 -0
  60. package/dist/src/abi/connectors/v2/B-MAKERDAO-A.js +4 -0
  61. package/dist/src/abi/connectors/v2/BASIC-A.js +136 -0
  62. package/dist/src/abi/connectors/v2/BASIC-B.js +4 -0
  63. package/dist/src/abi/connectors/v2/BASIC-C.js +4 -0
  64. package/dist/src/abi/connectors/v2/COMP-A.js +4 -0
  65. package/dist/src/abi/connectors/v2/COMPOUND-A.js +4 -0
  66. package/dist/src/abi/connectors/v2/COMPOUND-IMPORT-A.js +4 -0
  67. package/dist/src/abi/connectors/v2/COMPOUND-IMPORT-B.js +195 -0
  68. package/dist/src/abi/connectors/v2/G-UNISWAP-A.js +4 -0
  69. package/dist/src/abi/connectors/v2/GELATO-AAVE-A.js +4 -0
  70. package/dist/src/abi/connectors/v2/INST-A.js +4 -0
  71. package/dist/src/abi/connectors/v2/INST-LM-A.js +4 -0
  72. package/dist/src/abi/connectors/v2/INST-STAKING-A.js +4 -0
  73. package/dist/src/abi/connectors/v2/INST-STAKING-B.js +4 -0
  74. package/dist/src/abi/connectors/v2/INSTAPOOL-A.js +4 -0
  75. package/dist/src/abi/connectors/v2/LIQUITY-A.js +4 -0
  76. package/dist/src/abi/connectors/v2/MAKERDAO-A.js +4 -0
  77. package/dist/src/abi/connectors/v2/MAKERDAO-CLAIM-A.js +136 -0
  78. package/dist/src/abi/connectors/v2/PARASWAP-A.js +4 -0
  79. package/dist/src/abi/connectors/v2/POLYGON-BRIDGE-A.js +4 -0
  80. package/dist/src/abi/connectors/v2/REFINANCE-A.js +4 -0
  81. package/dist/src/abi/connectors/v2/REFLEXER-A.js +4 -0
  82. package/dist/src/abi/connectors/v2/STAKE-ERC20-A.js +4 -0
  83. package/dist/src/abi/connectors/v2/UNISWAP-A.js +297 -0
  84. package/dist/src/abi/connectors/v2/UNISWAP-V2-A.js +4 -0
  85. package/dist/src/abi/connectors/v2/UNISWAP-V3-A.js +4 -0
  86. package/dist/src/abi/connectors/v2/UNISWAP-V3-STAKE-A.js +4 -0
  87. package/dist/src/abi/connectors/v2/WETH-A.js +4 -0
  88. package/dist/src/abi/connectors/v2/YEARN-VAULT-A.js +4 -0
  89. package/dist/src/abi/connectors/v2/index.js +89 -0
  90. package/dist/src/abi/index.js +4 -2
  91. package/dist/src/abi/interopX.json +1436 -0
  92. package/dist/src/api/index.js +1 -1
  93. package/dist/src/constants/addresses.js +4 -7
  94. package/dist/src/constants/blockConfirmations.js +8 -0
  95. package/dist/src/constants/index.js +1 -0
  96. package/dist/src/constants/tokens.js +44 -51
  97. package/dist/src/db/models/transaction.js +11 -9
  98. package/dist/src/gnosis/actions/aaveV2/index.js +11 -0
  99. package/dist/src/gnosis/actions/aaveV2/source.js +75 -0
  100. package/dist/src/gnosis/actions/aaveV2/target.js +8 -0
  101. package/dist/src/gnosis/actions/index.js +2 -2
  102. package/dist/src/index.js +1 -1
  103. package/dist/src/net/protocol/dial/SignatureDialProtocol.js +2 -2
  104. package/dist/src/tasks/InteropX/ProcessSubmitSubmitEvents.js +180 -0
  105. package/dist/src/tasks/{InteropXContract/SyncBridgeRequestEvents.js → InteropX/SyncLogSubmitEvents.js} +23 -15
  106. package/dist/src/tasks/Transactions/SyncTransactionStatusTask.js +6 -3
  107. package/dist/src/tasks/index.js +9 -13
  108. package/dist/src/typechain/{InteropXContract.js → InteropX.js} +0 -0
  109. package/dist/src/typechain/factories/InteropX__factory.js +1928 -0
  110. package/dist/src/typechain/factories/index.js +3 -3
  111. package/dist/src/typechain/index.js +3 -3
  112. package/dist/src/utils/index.js +68 -31
  113. package/package.json +4 -2
  114. package/src/abi/connectors/index.ts +14 -0
  115. package/src/abi/connectors/v1/aave.ts +147 -0
  116. package/src/abi/connectors/v1/aave_claim.ts +3 -0
  117. package/src/abi/connectors/v1/aave_migrate.ts +108 -0
  118. package/src/abi/connectors/v1/aave_polygon_migrate.ts +109 -0
  119. package/src/abi/connectors/v1/aave_stake.ts +3 -0
  120. package/src/abi/connectors/v1/aave_v1_import.ts +53 -0
  121. package/src/abi/connectors/v1/aave_v2.ts +229 -0
  122. package/src/abi/connectors/v1/aave_v2_import.ts +58 -0
  123. package/src/abi/connectors/v1/authority.ts +99 -0
  124. package/src/abi/connectors/v1/basic.ts +135 -0
  125. package/src/abi/connectors/v1/chi.ts +35 -0
  126. package/src/abi/connectors/v1/comp.ts +3 -0
  127. package/src/abi/connectors/v1/compound.ts +3 -0
  128. package/src/abi/connectors/v1/compoundImport.ts +68 -0
  129. package/src/abi/connectors/v1/compoundImport_v2.ts +3 -0
  130. package/src/abi/connectors/v1/compound_old.ts +447 -0
  131. package/src/abi/connectors/v1/curve.ts +139 -0
  132. package/src/abi/connectors/v1/curve_claim.ts +62 -0
  133. package/src/abi/connectors/v1/curve_gauge.ts +157 -0
  134. package/src/abi/connectors/v1/curve_sbtc.ts +139 -0
  135. package/src/abi/connectors/v1/curve_susd.ts +139 -0
  136. package/src/abi/connectors/v1/curve_three.ts +78 -0
  137. package/src/abi/connectors/v1/curve_y.ts +139 -0
  138. package/src/abi/connectors/v1/dsa_migrate_v1_to_v2.ts +3 -0
  139. package/src/abi/connectors/v1/dydx.ts +147 -0
  140. package/src/abi/connectors/v1/dydx_flash.ts +51 -0
  141. package/src/abi/connectors/v1/fee.ts +49 -0
  142. package/src/abi/connectors/v1/gelato.ts +1137 -0
  143. package/src/abi/connectors/v1/index.ts +42 -0
  144. package/src/abi/connectors/v1/instapool.ts +438 -0
  145. package/src/abi/connectors/v1/instapool_v2.ts +125 -0
  146. package/src/abi/connectors/v1/kyber.ts +116 -0
  147. package/src/abi/connectors/v1/maker.ts +479 -0
  148. package/src/abi/connectors/v1/maker_old.ts +299 -0
  149. package/src/abi/connectors/v1/math.ts +42 -0
  150. package/src/abi/connectors/v1/migrate.ts +45 -0
  151. package/src/abi/connectors/v1/oasis.ts +197 -0
  152. package/src/abi/connectors/v1/oneInch.ts +159 -0
  153. package/src/abi/connectors/v1/polygon_bridge.ts +3 -0
  154. package/src/abi/connectors/v1/refinance.ts +3 -0
  155. package/src/abi/connectors/v1/staking.ts +219 -0
  156. package/src/abi/connectors/v1/swerve.ts +178 -0
  157. package/src/abi/connectors/v1/uniswap.ts +297 -0
  158. package/src/abi/connectors/v2/1INCH-A.ts +3 -0
  159. package/src/abi/connectors/v2/1INCH-B.ts +3 -0
  160. package/src/abi/connectors/v2/AAVE-CLAIM-A.ts +3 -0
  161. package/src/abi/connectors/v2/AAVE-CLAIM-B.ts +165 -0
  162. package/src/abi/connectors/v2/AAVE-STAKE-A.ts +3 -0
  163. package/src/abi/connectors/v2/AAVE-V1-A.ts +130 -0
  164. package/src/abi/connectors/v2/AAVE-V1-IMPORT-A.ts +3 -0
  165. package/src/abi/connectors/v2/AAVE-V2-A.ts +229 -0
  166. package/src/abi/connectors/v2/AAVE-V2-IMPORT-A.ts +3 -0
  167. package/src/abi/connectors/v2/AAVE-V2-IMPORT-B.ts +224 -0
  168. package/src/abi/connectors/v2/AUTHORITY-A.ts +99 -0
  169. package/src/abi/connectors/v2/B-COMPOUND-A.ts +3 -0
  170. package/src/abi/connectors/v2/B-LIQUITY-A.ts +3 -0
  171. package/src/abi/connectors/v2/B-MAKERDAO-A.ts +3 -0
  172. package/src/abi/connectors/v2/BASIC-A.ts +135 -0
  173. package/src/abi/connectors/v2/BASIC-B.ts +3 -0
  174. package/src/abi/connectors/v2/BASIC-C.ts +3 -0
  175. package/src/abi/connectors/v2/COMP-A.ts +3 -0
  176. package/src/abi/connectors/v2/COMPOUND-A.ts +3 -0
  177. package/src/abi/connectors/v2/COMPOUND-IMPORT-A.ts +3 -0
  178. package/src/abi/connectors/v2/COMPOUND-IMPORT-B.ts +194 -0
  179. package/src/abi/connectors/v2/G-UNISWAP-A.ts +3 -0
  180. package/src/abi/connectors/v2/GELATO-AAVE-A.ts +3 -0
  181. package/src/abi/connectors/v2/INST-A.ts +3 -0
  182. package/src/abi/connectors/v2/INST-LM-A.ts +3 -0
  183. package/src/abi/connectors/v2/INST-STAKING-A.ts +3 -0
  184. package/src/abi/connectors/v2/INST-STAKING-B.ts +3 -0
  185. package/src/abi/connectors/v2/INSTAPOOL-A.ts +3 -0
  186. package/src/abi/connectors/v2/LIQUITY-A.ts +3 -0
  187. package/src/abi/connectors/v2/MAKERDAO-A.ts +3 -0
  188. package/src/abi/connectors/v2/MAKERDAO-CLAIM-A.ts +135 -0
  189. package/src/abi/connectors/v2/PARASWAP-A.ts +3 -0
  190. package/src/abi/connectors/v2/POLYGON-BRIDGE-A.ts +3 -0
  191. package/src/abi/connectors/v2/REFINANCE-A.ts +3 -0
  192. package/src/abi/connectors/v2/REFLEXER-A.ts +3 -0
  193. package/src/abi/connectors/v2/STAKE-ERC20-A.ts +3 -0
  194. package/src/abi/connectors/v2/UNISWAP-A.ts +297 -0
  195. package/src/abi/connectors/v2/UNISWAP-V2-A.ts +3 -0
  196. package/src/abi/connectors/v2/UNISWAP-V3-A.ts +3 -0
  197. package/src/abi/connectors/v2/UNISWAP-V3-STAKE-A.ts +3 -0
  198. package/src/abi/connectors/v2/WETH-A.ts +3 -0
  199. package/src/abi/connectors/v2/YEARN-VAULT-A.ts +3 -0
  200. package/src/abi/connectors/v2/index.ts +87 -0
  201. package/src/abi/index.ts +7 -5
  202. package/src/abi/interopX.json +1436 -0
  203. package/src/api/index.ts +1 -1
  204. package/src/constants/addresses.ts +5 -8
  205. package/src/constants/blockConfirmations.ts +5 -0
  206. package/src/constants/index.ts +1 -0
  207. package/src/constants/tokens.ts +44 -51
  208. package/src/db/models/transaction.ts +28 -37
  209. package/src/gnosis/actions/aaveV2/index.ts +9 -0
  210. package/src/gnosis/actions/aaveV2/source.ts +120 -0
  211. package/src/gnosis/actions/aaveV2/target.ts +13 -0
  212. package/src/gnosis/actions/index.ts +2 -2
  213. package/src/net/protocol/dial/SignatureDialProtocol.ts +3 -2
  214. package/src/tasks/InteropX/ProcessSubmitSubmitEvents.ts +270 -0
  215. package/src/tasks/InteropX/SyncLogSubmitEvents.ts +138 -0
  216. package/src/tasks/Transactions/SyncTransactionStatusTask.ts +6 -3
  217. package/src/tasks/index.ts +8 -15
  218. package/src/typechain/InteropX.ts +1216 -0
  219. package/src/typechain/factories/InteropX__factory.ts +1932 -0
  220. package/src/typechain/factories/index.ts +1 -1
  221. package/src/typechain/index.ts +2 -2
  222. package/src/utils/index.ts +185 -88
  223. package/dist/src/abi/interopXContract.json +0 -454
  224. package/dist/src/gnosis/actions/withdraw/index.js +0 -55
  225. package/dist/src/tasks/InteropXContract/ProcessBridgeRequestEvents.js +0 -152
  226. package/dist/src/tasks/InteropXContract/SyncBridgeCommittedEvents.js +0 -92
  227. package/dist/src/tasks/InteropXContract/SyncBridgeRequestSentEvents.js +0 -90
  228. package/dist/src/typechain/factories/InteropXContract__factory.js +0 -635
  229. package/src/abi/interopXContract.json +0 -454
  230. package/src/gnosis/actions/withdraw/index.ts +0 -77
  231. package/src/tasks/InteropXContract/ProcessBridgeRequestEvents.ts +0 -216
  232. package/src/tasks/InteropXContract/SyncBridgeCommittedEvents.ts +0 -124
  233. package/src/tasks/InteropXContract/SyncBridgeRequestEvents.ts +0 -115
  234. package/src/tasks/InteropXContract/SyncBridgeRequestSentEvents.ts +0 -121
  235. package/src/typechain/InteropXContract.ts +0 -680
  236. package/src/typechain/factories/InteropXContract__factory.ts +0 -642
@@ -1,454 +0,0 @@
1
- [
2
- {
3
- "anonymous": false,
4
- "inputs": [
5
- {
6
- "indexed": false,
7
- "internalType": "string",
8
- "name": "actionId",
9
- "type": "string"
10
- },
11
- {
12
- "indexed": true,
13
- "internalType": "address",
14
- "name": "bridger",
15
- "type": "address"
16
- },
17
- {
18
- "components": [
19
- {
20
- "components": [
21
- {
22
- "internalType": "address",
23
- "name": "sourceToken",
24
- "type": "address"
25
- },
26
- {
27
- "internalType": "address",
28
- "name": "targetToken",
29
- "type": "address"
30
- },
31
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
32
- ],
33
- "internalType": "struct InteropXContractBeta.TokenInfo[]",
34
- "name": "supply",
35
- "type": "tuple[]"
36
- },
37
- {
38
- "components": [
39
- {
40
- "internalType": "address",
41
- "name": "sourceToken",
42
- "type": "address"
43
- },
44
- {
45
- "internalType": "address",
46
- "name": "targetToken",
47
- "type": "address"
48
- },
49
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
50
- ],
51
- "internalType": "struct InteropXContractBeta.TokenInfo[]",
52
- "name": "withdraw",
53
- "type": "tuple[]"
54
- }
55
- ],
56
- "indexed": false,
57
- "internalType": "struct InteropXContractBeta.Position",
58
- "name": "position",
59
- "type": "tuple"
60
- },
61
- {
62
- "indexed": true,
63
- "internalType": "uint32",
64
- "name": "sourceChainId",
65
- "type": "uint32"
66
- },
67
- {
68
- "indexed": false,
69
- "internalType": "uint32",
70
- "name": "targetChainId",
71
- "type": "uint32"
72
- },
73
- {
74
- "indexed": true,
75
- "internalType": "bytes32",
76
- "name": "requestTransactionHash",
77
- "type": "bytes32"
78
- },
79
- {
80
- "indexed": false,
81
- "internalType": "bytes",
82
- "name": "metadata",
83
- "type": "bytes"
84
- }
85
- ],
86
- "name": "LogBridgeCommitted",
87
- "type": "event"
88
- },
89
- {
90
- "anonymous": false,
91
- "inputs": [
92
- {
93
- "indexed": false,
94
- "internalType": "string",
95
- "name": "actionId",
96
- "type": "string"
97
- },
98
- {
99
- "indexed": true,
100
- "internalType": "address",
101
- "name": "bridger",
102
- "type": "address"
103
- },
104
- {
105
- "components": [
106
- {
107
- "components": [
108
- {
109
- "internalType": "address",
110
- "name": "sourceToken",
111
- "type": "address"
112
- },
113
- {
114
- "internalType": "address",
115
- "name": "targetToken",
116
- "type": "address"
117
- },
118
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
119
- ],
120
- "internalType": "struct InteropXContractBeta.TokenInfo[]",
121
- "name": "supply",
122
- "type": "tuple[]"
123
- },
124
- {
125
- "components": [
126
- {
127
- "internalType": "address",
128
- "name": "sourceToken",
129
- "type": "address"
130
- },
131
- {
132
- "internalType": "address",
133
- "name": "targetToken",
134
- "type": "address"
135
- },
136
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
137
- ],
138
- "internalType": "struct InteropXContractBeta.TokenInfo[]",
139
- "name": "withdraw",
140
- "type": "tuple[]"
141
- }
142
- ],
143
- "indexed": false,
144
- "internalType": "struct InteropXContractBeta.Position",
145
- "name": "position",
146
- "type": "tuple"
147
- },
148
- {
149
- "indexed": false,
150
- "internalType": "uint256",
151
- "name": "sourceChainId",
152
- "type": "uint256"
153
- },
154
- {
155
- "indexed": true,
156
- "internalType": "uint256",
157
- "name": "targetChainId",
158
- "type": "uint256"
159
- },
160
- {
161
- "indexed": true,
162
- "internalType": "bytes32",
163
- "name": "requestTransactionHash",
164
- "type": "bytes32"
165
- },
166
- {
167
- "indexed": false,
168
- "internalType": "bytes32",
169
- "name": "targetCommittedTransactionHash",
170
- "type": "bytes32"
171
- },
172
- {
173
- "indexed": false,
174
- "internalType": "bytes",
175
- "name": "metadata",
176
- "type": "bytes"
177
- }
178
- ],
179
- "name": "LogBridgeCompleted",
180
- "type": "event"
181
- },
182
- {
183
- "anonymous": false,
184
- "inputs": [
185
- {
186
- "indexed": false,
187
- "internalType": "string",
188
- "name": "actionId",
189
- "type": "string"
190
- },
191
- {
192
- "indexed": true,
193
- "internalType": "address",
194
- "name": "bridger",
195
- "type": "address"
196
- },
197
- {
198
- "components": [
199
- {
200
- "components": [
201
- {
202
- "internalType": "address",
203
- "name": "sourceToken",
204
- "type": "address"
205
- },
206
- {
207
- "internalType": "address",
208
- "name": "targetToken",
209
- "type": "address"
210
- },
211
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
212
- ],
213
- "internalType": "struct InteropXContractBeta.TokenInfo[]",
214
- "name": "supply",
215
- "type": "tuple[]"
216
- },
217
- {
218
- "components": [
219
- {
220
- "internalType": "address",
221
- "name": "sourceToken",
222
- "type": "address"
223
- },
224
- {
225
- "internalType": "address",
226
- "name": "targetToken",
227
- "type": "address"
228
- },
229
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
230
- ],
231
- "internalType": "struct InteropXContractBeta.TokenInfo[]",
232
- "name": "withdraw",
233
- "type": "tuple[]"
234
- }
235
- ],
236
- "indexed": false,
237
- "internalType": "struct InteropXContractBeta.Position",
238
- "name": "position",
239
- "type": "tuple"
240
- },
241
- {
242
- "indexed": false,
243
- "internalType": "uint256",
244
- "name": "sourceChainId",
245
- "type": "uint256"
246
- },
247
- {
248
- "indexed": true,
249
- "internalType": "uint256",
250
- "name": "targetChainId",
251
- "type": "uint256"
252
- },
253
- {
254
- "indexed": false,
255
- "internalType": "bytes",
256
- "name": "metadata",
257
- "type": "bytes"
258
- }
259
- ],
260
- "name": "LogBridgeRequest",
261
- "type": "event"
262
- },
263
- {
264
- "anonymous": false,
265
- "inputs": [
266
- {
267
- "indexed": false,
268
- "internalType": "string",
269
- "name": "actionId",
270
- "type": "string"
271
- },
272
- {
273
- "indexed": true,
274
- "internalType": "address",
275
- "name": "bridger",
276
- "type": "address"
277
- },
278
- {
279
- "components": [
280
- {
281
- "components": [
282
- {
283
- "internalType": "address",
284
- "name": "sourceToken",
285
- "type": "address"
286
- },
287
- {
288
- "internalType": "address",
289
- "name": "targetToken",
290
- "type": "address"
291
- },
292
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
293
- ],
294
- "internalType": "struct InteropXContractBeta.TokenInfo[]",
295
- "name": "supply",
296
- "type": "tuple[]"
297
- },
298
- {
299
- "components": [
300
- {
301
- "internalType": "address",
302
- "name": "sourceToken",
303
- "type": "address"
304
- },
305
- {
306
- "internalType": "address",
307
- "name": "targetToken",
308
- "type": "address"
309
- },
310
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
311
- ],
312
- "internalType": "struct InteropXContractBeta.TokenInfo[]",
313
- "name": "withdraw",
314
- "type": "tuple[]"
315
- }
316
- ],
317
- "indexed": false,
318
- "internalType": "struct InteropXContractBeta.Position",
319
- "name": "position",
320
- "type": "tuple"
321
- },
322
- {
323
- "indexed": false,
324
- "internalType": "uint32",
325
- "name": "sourceChainId",
326
- "type": "uint32"
327
- },
328
- {
329
- "indexed": true,
330
- "internalType": "uint32",
331
- "name": "targetChainId",
332
- "type": "uint32"
333
- },
334
- {
335
- "indexed": true,
336
- "internalType": "bytes32",
337
- "name": "requestTransactionHash",
338
- "type": "bytes32"
339
- },
340
- {
341
- "indexed": false,
342
- "internalType": "bytes",
343
- "name": "metadata",
344
- "type": "bytes"
345
- }
346
- ],
347
- "name": "LogBridgeRequestSent",
348
- "type": "event"
349
- },
350
- {
351
- "inputs": [
352
- { "internalType": "string", "name": "actionId", "type": "string" },
353
- { "internalType": "address", "name": "to_", "type": "address" },
354
- { "internalType": "address", "name": "sourceToken_", "type": "address" },
355
- { "internalType": "address", "name": "targetToken_", "type": "address" },
356
- { "internalType": "uint256", "name": "amount_", "type": "uint256" },
357
- { "internalType": "uint32", "name": "sourceChainId_", "type": "uint32" },
358
- {
359
- "internalType": "bytes32",
360
- "name": "transactionHash_",
361
- "type": "bytes32"
362
- },
363
- { "internalType": "bytes", "name": "metadata_", "type": "bytes" }
364
- ],
365
- "name": "completeBridge",
366
- "outputs": [],
367
- "stateMutability": "nonpayable",
368
- "type": "function"
369
- },
370
- {
371
- "inputs": [
372
- { "internalType": "address", "name": "user", "type": "address" },
373
- { "internalType": "address[]", "name": "tokens", "type": "address[]" }
374
- ],
375
- "name": "getBridgeAmounts",
376
- "outputs": [
377
- {
378
- "components": [
379
- { "internalType": "uint256", "name": "deposit", "type": "uint256" },
380
- { "internalType": "uint256", "name": "withdraw", "type": "uint256" }
381
- ],
382
- "internalType": "struct InteropXContractBeta.UserData[]",
383
- "name": "userData",
384
- "type": "tuple[]"
385
- }
386
- ],
387
- "stateMutability": "view",
388
- "type": "function"
389
- },
390
- {
391
- "inputs": [
392
- { "internalType": "string", "name": "actionId", "type": "string" },
393
- { "internalType": "address", "name": "sourceToken_", "type": "address" },
394
- { "internalType": "address", "name": "targetToken_", "type": "address" },
395
- { "internalType": "uint256", "name": "amount_", "type": "uint256" },
396
- { "internalType": "uint32", "name": "targetChainId_", "type": "uint32" },
397
- { "internalType": "bytes", "name": "metadata_", "type": "bytes" }
398
- ],
399
- "name": "requestWithdraw",
400
- "outputs": [],
401
- "stateMutability": "nonpayable",
402
- "type": "function"
403
- },
404
- {
405
- "inputs": [
406
- { "internalType": "address", "name": "token", "type": "address" },
407
- { "internalType": "bool", "name": "toggle", "type": "bool" }
408
- ],
409
- "name": "toggleWhitelist",
410
- "outputs": [],
411
- "stateMutability": "nonpayable",
412
- "type": "function"
413
- },
414
- {
415
- "inputs": [
416
- { "internalType": "address", "name": "", "type": "address" },
417
- { "internalType": "address", "name": "", "type": "address" }
418
- ],
419
- "name": "userMapping",
420
- "outputs": [
421
- { "internalType": "uint256", "name": "deposit", "type": "uint256" },
422
- { "internalType": "uint256", "name": "withdraw", "type": "uint256" }
423
- ],
424
- "stateMutability": "view",
425
- "type": "function"
426
- },
427
- {
428
- "inputs": [{ "internalType": "address", "name": "", "type": "address" }],
429
- "name": "whitelistedTokens",
430
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
431
- "stateMutability": "view",
432
- "type": "function"
433
- },
434
- {
435
- "inputs": [
436
- { "internalType": "string", "name": "actionId", "type": "string" },
437
- { "internalType": "address", "name": "user_", "type": "address" },
438
- { "internalType": "address", "name": "sourceToken_", "type": "address" },
439
- { "internalType": "address", "name": "targetToken_", "type": "address" },
440
- { "internalType": "uint256", "name": "amount_", "type": "uint256" },
441
- { "internalType": "uint32", "name": "chainId_", "type": "uint32" },
442
- {
443
- "internalType": "bytes32",
444
- "name": "transactionHash_",
445
- "type": "bytes32"
446
- },
447
- { "internalType": "bytes", "name": "metadata_", "type": "bytes" }
448
- ],
449
- "name": "withdrawRequested",
450
- "outputs": [],
451
- "stateMutability": "nonpayable",
452
- "type": "function"
453
- }
454
- ]
@@ -1,55 +0,0 @@
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
- const abi_1 = __importDefault(require("@/abi"));
7
- const config_1 = __importDefault(require("@/config"));
8
- const constants_1 = require("@/constants");
9
- const utils_1 = require("@/utils");
10
- const ethers_1 = require("ethers");
11
- const ethers_multisend_1 = require("ethers-multisend");
12
- async function default_1(transaction, type) {
13
- const transactions = [];
14
- const logs = [];
15
- if (transaction.actionId !== 'withdraw') {
16
- throw new Error(`Invalid action: ${transaction.actionId}`);
17
- }
18
- if (type !== 'source') {
19
- throw new Error(`[WIP] Type not supported: ${type}`);
20
- }
21
- if (transaction.sourceStatus === 'pending') {
22
- throw Error('Source transaction already processesing');
23
- }
24
- if (transaction.sourceStatus === 'pending') {
25
- throw Error('Source transaction already processed');
26
- }
27
- if (!transaction.requestEvent) {
28
- throw Error('Something went wrong, source transaction has no request event');
29
- }
30
- const { actionId, bridger, position, sourceChainId, targetChainId, metadata } = transaction.requestEvent;
31
- const sourceChainProvider = new ethers_1.ethers.providers.JsonRpcProvider((0, utils_1.getRpcProviderUrl)(targetChainId));
32
- const sourceWallet = new ethers_1.ethers.Wallet(config_1.default.privateKey, sourceChainProvider);
33
- const contractAddress = constants_1.addresses[sourceChainId].interopXContract;
34
- const contract = (0, utils_1.getContract)(contractAddress, abi_1.default.interopXContract, sourceWallet);
35
- const sourceToken = constants_1.tokens[sourceChainId].find(t => t.address.toLowerCase() === position.withdraw[0].sourceToken.toLowerCase());
36
- if (!sourceToken) {
37
- throw Error('Source token not found');
38
- }
39
- const targetToken = constants_1.tokens[targetChainId].find(t => t.address.toLowerCase() === position.withdraw[0].targetToken.toLowerCase());
40
- if (!targetToken) {
41
- throw Error('Target token not found');
42
- }
43
- if (!sourceToken.aliases.some(alias => targetToken.aliases.includes(alias))) {
44
- throw Error('Source and target token must be the same');
45
- }
46
- const { data } = await contract.populateTransaction.withdrawRequested(actionId, bridger, position.withdraw[0].sourceToken, position.withdraw[0].targetToken, position.withdraw[0].amount, targetChainId, transaction.requestTransactionHash, metadata);
47
- transactions.push({
48
- to: contractAddress,
49
- data: data,
50
- value: '0',
51
- operation: ethers_multisend_1.OperationType.Call,
52
- });
53
- return { transactions, logs };
54
- }
55
- exports.default = default_1;
@@ -1,152 +0,0 @@
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
- const BaseTask_1 = require("../BaseTask");
7
- const logger_1 = __importDefault(require("@/logger"));
8
- const ethers_1 = require("ethers");
9
- const abi_1 = __importDefault(require("@/abi"));
10
- const db_1 = require("@/db");
11
- const utils_1 = require("@/utils");
12
- const constants_1 = require("@/constants");
13
- const sequelize_1 = require("sequelize");
14
- const config_1 = __importDefault(require("@/config"));
15
- const waait_1 = __importDefault(require("waait"));
16
- const gnosis_1 = require("@/gnosis");
17
- const net_1 = require("@/net");
18
- class ProccessBridgeRequestEvents extends BaseTask_1.BaseTask {
19
- constructor({ chainId }) {
20
- super({
21
- logger: new logger_1.default("InteropXContract::ProccessBridgeRequestEvents"),
22
- });
23
- this.leadNodeOnly = true;
24
- this.chainId = chainId;
25
- }
26
- async pollHandler() {
27
- var _a;
28
- const blockNumber = await this.provider.getBlockNumber();
29
- const transaction = await db_1.Transaction.findOne({
30
- where: {
31
- status: 'pending',
32
- sourceStatus: 'uninitialised',
33
- createdAt: {
34
- [sequelize_1.Op.gte]: new Date(Date.now() - 12 * 60 * 60 * 1000),
35
- },
36
- sourceDelayUntil: {
37
- [sequelize_1.Op.or]: {
38
- [sequelize_1.Op.is]: null,
39
- [sequelize_1.Op.lt]: new Date(),
40
- }
41
- },
42
- requestBlockNumber: {
43
- [sequelize_1.Op.lt]: blockNumber - 12,
44
- },
45
- sourceChainId: this.chainId,
46
- }
47
- });
48
- if (!transaction) {
49
- return;
50
- }
51
- console.log(`Processing transaction ${transaction.transactionHash}`);
52
- transaction.targetStatus = 'pending';
53
- await transaction.save();
54
- const ownersThreshold = await this.safeContract.getThreshold();
55
- await (0, waait_1.default)(10000);
56
- let data, logs = [];
57
- try {
58
- ({ data, logs } = await (0, gnosis_1.buildGnosisAction)(transaction, 'source'));
59
- }
60
- catch (error) {
61
- console.log(error);
62
- transaction.sourceStatus = 'failed';
63
- transaction.sourceErrors = [error.message];
64
- transaction.targetStatus = 'failed';
65
- transaction.status = 'failed';
66
- await transaction.save();
67
- net_1.protocol.sendTransaction(transaction);
68
- return;
69
- }
70
- let gnosisTx = await (0, utils_1.generateGnosisTransaction)({
71
- baseGas: "0",
72
- data,
73
- gasPrice: "0",
74
- gasToken: "0x0000000000000000000000000000000000000000",
75
- nonce: '0',
76
- operation: "1",
77
- refundReceiver: "0x0000000000000000000000000000000000000000",
78
- safeAddress: this.safeContractAddress,
79
- safeTxGas: "79668",
80
- to: constants_1.addresses[transaction.sourceChainId].multisend,
81
- value: "0",
82
- }, this.safeContract);
83
- const owners = await this.safeContract.getOwners().then(owners => owners.map(owner => owner.toLowerCase()));
84
- const ownerPeerIds = net_1.peerPool.activePeers.filter(peer => owners.includes(peer.publicAddress.toLowerCase())).map(peer => peer.id);
85
- console.log(`Collecting signatures for execution ${transaction.transactionHash}`);
86
- console.log(ownerPeerIds);
87
- const signatures = await net_1.protocol.requestSignatures({
88
- type: 'source',
89
- transactionHash: transaction.transactionHash,
90
- safeTxGas: gnosisTx.safeTxGas,
91
- safeNonce: gnosisTx.nonce
92
- }, ownerPeerIds);
93
- const validSignatures = signatures.filter(s => !!s.data && s.data !== '0x');
94
- console.log({ signatures, validSignatures, ownersThreshold: ownersThreshold.toString() });
95
- if (validSignatures.length === 0 || ownersThreshold.gt(validSignatures.length)) {
96
- await transaction.save();
97
- transaction.sourceDelayUntil = new Date(Date.now() + 30 * 1000);
98
- transaction.sourceStatus = 'uninitialised';
99
- await transaction.save();
100
- const errorMessage = (_a = signatures.find(s => !!s.error)) === null || _a === void 0 ? void 0 : _a.error;
101
- throw new Error(`Not enough signatures` + (errorMessage ? `: ${errorMessage}` : ''));
102
- }
103
- console.log(`Executing transaction for execution ${transaction.transactionHash}`);
104
- const { data: txData } = await this.safeContract.populateTransaction.execTransaction(gnosisTx.to, gnosisTx.value, gnosisTx.data, gnosisTx.operation, gnosisTx.safeTxGas, gnosisTx.baseGas, gnosisTx.gasPrice, gnosisTx.gasToken, gnosisTx.refundReceiver, (0, utils_1.buildSignatureBytes)(validSignatures));
105
- const txSent = await this.sourceWallet.sendTransaction({
106
- from: this.sourceWallet.address,
107
- gasPrice: ethers_1.ethers.BigNumber.from(120 * 10 ** 9),
108
- to: this.safeContractAddress,
109
- data: txData,
110
- });
111
- console.log(txSent);
112
- const receipt = await txSent.wait();
113
- const parsedLogs = [];
114
- receipt.logs.forEach((log) => {
115
- try {
116
- parsedLogs.push(this.safeContract.interface.parseLog(log));
117
- }
118
- catch (e) { }
119
- });
120
- if (parsedLogs.find(e => e.name === 'ExecutionSuccess')) {
121
- console.log('ExecutionSuccess');
122
- transaction.sourceStatus = 'success';
123
- if (txSent.blockNumber)
124
- transaction.sourceBlockNumber = txSent.blockNumber;
125
- transaction.sourceTransactionHash = txSent.hash;
126
- transaction.sourceLogs = logs;
127
- transaction.status = 'success';
128
- await transaction.save();
129
- }
130
- else {
131
- console.log('ExecutionFailure');
132
- transaction.sourceStatus = 'failed';
133
- if (txSent.blockNumber)
134
- transaction.sourceBlockNumber = txSent.blockNumber;
135
- transaction.sourceTransactionHash = txSent.hash;
136
- transaction.sourceTransactionHash = txSent.hash;
137
- transaction.status = 'failed';
138
- await transaction.save();
139
- }
140
- net_1.protocol.sendTransaction(transaction);
141
- }
142
- async start() {
143
- this.contractAddress = constants_1.addresses[this.chainId].interopXContract;
144
- this.provider = new ethers_1.ethers.providers.JsonRpcProvider((0, utils_1.getRpcProviderUrl)(this.chainId));
145
- this.sourceWallet = new ethers_1.ethers.Wallet(config_1.default.privateKey, this.provider);
146
- this.contract = (0, utils_1.getContract)(this.contractAddress, abi_1.default.interopXContract, this.sourceWallet);
147
- this.safeContractAddress = constants_1.addresses[this.chainId].gnosisSafe;
148
- this.safeContract = (0, utils_1.getContract)(this.safeContractAddress, abi_1.default.gnosisSafe, this.sourceWallet);
149
- await super.start();
150
- }
151
- }
152
- exports.default = ProccessBridgeRequestEvents;