@instadapp/interop-x 0.0.0-dev.326bdca → 0.0.0-dev.32db40c

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/.github/workflows/ci.yml +19 -0
  2. package/dist/package.json +15 -12
  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 +62 -39
  97. package/dist/src/db/models/transaction.js +12 -12
  98. package/dist/src/gnosis/actions/aaveV2/index.js +11 -0
  99. package/dist/src/gnosis/actions/aaveV2/source.js +73 -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/gnosis/index.js +4 -4
  103. package/dist/src/index.js +1 -1
  104. package/dist/src/net/protocol/dial/SignatureDialProtocol.js +6 -2
  105. package/dist/src/tasks/InteropX/ProcessSubmitSubmitEvents.js +180 -0
  106. package/dist/src/tasks/{InteropXContract/SyncBridgeRequestEvents.js → InteropX/SyncLogSubmitEvents.js} +26 -18
  107. package/dist/src/tasks/Transactions/SyncTransactionStatusTask.js +6 -3
  108. package/dist/src/tasks/index.js +10 -8
  109. package/dist/src/typechain/{InteropXContract.js → InteropX.js} +0 -0
  110. package/dist/src/typechain/factories/InteropX__factory.js +1928 -0
  111. package/dist/src/typechain/factories/index.js +3 -3
  112. package/dist/src/typechain/index.js +3 -3
  113. package/dist/src/utils/index.js +88 -33
  114. package/package.json +15 -12
  115. package/src/abi/connectors/index.ts +14 -0
  116. package/src/abi/connectors/v1/aave.ts +147 -0
  117. package/src/abi/connectors/v1/aave_claim.ts +3 -0
  118. package/src/abi/connectors/v1/aave_migrate.ts +108 -0
  119. package/src/abi/connectors/v1/aave_polygon_migrate.ts +109 -0
  120. package/src/abi/connectors/v1/aave_stake.ts +3 -0
  121. package/src/abi/connectors/v1/aave_v1_import.ts +53 -0
  122. package/src/abi/connectors/v1/aave_v2.ts +229 -0
  123. package/src/abi/connectors/v1/aave_v2_import.ts +58 -0
  124. package/src/abi/connectors/v1/authority.ts +99 -0
  125. package/src/abi/connectors/v1/basic.ts +135 -0
  126. package/src/abi/connectors/v1/chi.ts +35 -0
  127. package/src/abi/connectors/v1/comp.ts +3 -0
  128. package/src/abi/connectors/v1/compound.ts +3 -0
  129. package/src/abi/connectors/v1/compoundImport.ts +68 -0
  130. package/src/abi/connectors/v1/compoundImport_v2.ts +3 -0
  131. package/src/abi/connectors/v1/compound_old.ts +447 -0
  132. package/src/abi/connectors/v1/curve.ts +139 -0
  133. package/src/abi/connectors/v1/curve_claim.ts +62 -0
  134. package/src/abi/connectors/v1/curve_gauge.ts +157 -0
  135. package/src/abi/connectors/v1/curve_sbtc.ts +139 -0
  136. package/src/abi/connectors/v1/curve_susd.ts +139 -0
  137. package/src/abi/connectors/v1/curve_three.ts +78 -0
  138. package/src/abi/connectors/v1/curve_y.ts +139 -0
  139. package/src/abi/connectors/v1/dsa_migrate_v1_to_v2.ts +3 -0
  140. package/src/abi/connectors/v1/dydx.ts +147 -0
  141. package/src/abi/connectors/v1/dydx_flash.ts +51 -0
  142. package/src/abi/connectors/v1/fee.ts +49 -0
  143. package/src/abi/connectors/v1/gelato.ts +1137 -0
  144. package/src/abi/connectors/v1/index.ts +42 -0
  145. package/src/abi/connectors/v1/instapool.ts +438 -0
  146. package/src/abi/connectors/v1/instapool_v2.ts +125 -0
  147. package/src/abi/connectors/v1/kyber.ts +116 -0
  148. package/src/abi/connectors/v1/maker.ts +479 -0
  149. package/src/abi/connectors/v1/maker_old.ts +299 -0
  150. package/src/abi/connectors/v1/math.ts +42 -0
  151. package/src/abi/connectors/v1/migrate.ts +45 -0
  152. package/src/abi/connectors/v1/oasis.ts +197 -0
  153. package/src/abi/connectors/v1/oneInch.ts +159 -0
  154. package/src/abi/connectors/v1/polygon_bridge.ts +3 -0
  155. package/src/abi/connectors/v1/refinance.ts +3 -0
  156. package/src/abi/connectors/v1/staking.ts +219 -0
  157. package/src/abi/connectors/v1/swerve.ts +178 -0
  158. package/src/abi/connectors/v1/uniswap.ts +297 -0
  159. package/src/abi/connectors/v2/1INCH-A.ts +3 -0
  160. package/src/abi/connectors/v2/1INCH-B.ts +3 -0
  161. package/src/abi/connectors/v2/AAVE-CLAIM-A.ts +3 -0
  162. package/src/abi/connectors/v2/AAVE-CLAIM-B.ts +165 -0
  163. package/src/abi/connectors/v2/AAVE-STAKE-A.ts +3 -0
  164. package/src/abi/connectors/v2/AAVE-V1-A.ts +130 -0
  165. package/src/abi/connectors/v2/AAVE-V1-IMPORT-A.ts +3 -0
  166. package/src/abi/connectors/v2/AAVE-V2-A.ts +229 -0
  167. package/src/abi/connectors/v2/AAVE-V2-IMPORT-A.ts +3 -0
  168. package/src/abi/connectors/v2/AAVE-V2-IMPORT-B.ts +224 -0
  169. package/src/abi/connectors/v2/AUTHORITY-A.ts +99 -0
  170. package/src/abi/connectors/v2/B-COMPOUND-A.ts +3 -0
  171. package/src/abi/connectors/v2/B-LIQUITY-A.ts +3 -0
  172. package/src/abi/connectors/v2/B-MAKERDAO-A.ts +3 -0
  173. package/src/abi/connectors/v2/BASIC-A.ts +135 -0
  174. package/src/abi/connectors/v2/BASIC-B.ts +3 -0
  175. package/src/abi/connectors/v2/BASIC-C.ts +3 -0
  176. package/src/abi/connectors/v2/COMP-A.ts +3 -0
  177. package/src/abi/connectors/v2/COMPOUND-A.ts +3 -0
  178. package/src/abi/connectors/v2/COMPOUND-IMPORT-A.ts +3 -0
  179. package/src/abi/connectors/v2/COMPOUND-IMPORT-B.ts +194 -0
  180. package/src/abi/connectors/v2/G-UNISWAP-A.ts +3 -0
  181. package/src/abi/connectors/v2/GELATO-AAVE-A.ts +3 -0
  182. package/src/abi/connectors/v2/INST-A.ts +3 -0
  183. package/src/abi/connectors/v2/INST-LM-A.ts +3 -0
  184. package/src/abi/connectors/v2/INST-STAKING-A.ts +3 -0
  185. package/src/abi/connectors/v2/INST-STAKING-B.ts +3 -0
  186. package/src/abi/connectors/v2/INSTAPOOL-A.ts +3 -0
  187. package/src/abi/connectors/v2/LIQUITY-A.ts +3 -0
  188. package/src/abi/connectors/v2/MAKERDAO-A.ts +3 -0
  189. package/src/abi/connectors/v2/MAKERDAO-CLAIM-A.ts +135 -0
  190. package/src/abi/connectors/v2/PARASWAP-A.ts +3 -0
  191. package/src/abi/connectors/v2/POLYGON-BRIDGE-A.ts +3 -0
  192. package/src/abi/connectors/v2/REFINANCE-A.ts +3 -0
  193. package/src/abi/connectors/v2/REFLEXER-A.ts +3 -0
  194. package/src/abi/connectors/v2/STAKE-ERC20-A.ts +3 -0
  195. package/src/abi/connectors/v2/UNISWAP-A.ts +297 -0
  196. package/src/abi/connectors/v2/UNISWAP-V2-A.ts +3 -0
  197. package/src/abi/connectors/v2/UNISWAP-V3-A.ts +3 -0
  198. package/src/abi/connectors/v2/UNISWAP-V3-STAKE-A.ts +3 -0
  199. package/src/abi/connectors/v2/WETH-A.ts +3 -0
  200. package/src/abi/connectors/v2/YEARN-VAULT-A.ts +3 -0
  201. package/src/abi/connectors/v2/index.ts +87 -0
  202. package/src/abi/index.ts +7 -5
  203. package/src/abi/interopX.json +1436 -0
  204. package/src/api/index.ts +1 -1
  205. package/src/constants/addresses.ts +5 -8
  206. package/src/constants/blockConfirmations.ts +5 -0
  207. package/src/constants/index.ts +1 -0
  208. package/src/constants/tokens.ts +63 -40
  209. package/src/db/models/transaction.ts +31 -29
  210. package/src/gnosis/actions/aaveV2/index.ts +9 -0
  211. package/src/gnosis/actions/aaveV2/source.ts +118 -0
  212. package/src/gnosis/actions/aaveV2/target.ts +13 -0
  213. package/src/gnosis/actions/index.ts +2 -2
  214. package/src/gnosis/index.ts +5 -5
  215. package/src/net/protocol/dial/SignatureDialProtocol.ts +7 -2
  216. package/src/tasks/InteropX/ProcessSubmitSubmitEvents.ts +270 -0
  217. package/src/tasks/InteropX/SyncLogSubmitEvents.ts +138 -0
  218. package/src/tasks/Transactions/SyncTransactionStatusTask.ts +6 -3
  219. package/src/tasks/index.ts +10 -8
  220. package/src/typechain/InteropX.ts +1216 -0
  221. package/src/typechain/factories/InteropX__factory.ts +1932 -0
  222. package/src/typechain/factories/index.ts +1 -1
  223. package/src/typechain/index.ts +2 -2
  224. package/src/utils/index.ts +222 -97
  225. package/dist/src/abi/interopXContract.json +0 -391
  226. package/dist/src/gnosis/actions/withdraw/index.js +0 -41
  227. package/dist/src/tasks/InteropXContract/ProcessBridgeRequestEvents.js +0 -146
  228. package/dist/src/typechain/factories/InteropXContract__factory.js +0 -526
  229. package/src/abi/interopXContract.json +0 -391
  230. package/src/gnosis/actions/withdraw/index.ts +0 -56
  231. package/src/tasks/InteropXContract/ProcessBridgeRequestEvents.ts +0 -208
  232. package/src/tasks/InteropXContract/SyncBridgeRequestEvents.ts +0 -116
  233. package/src/typechain/InteropXContract.ts +0 -524
  234. package/src/typechain/factories/InteropXContract__factory.ts +0 -533
@@ -1,391 +0,0 @@
1
- [
2
- {
3
- "anonymous": false,
4
- "inputs": [
5
- {
6
- "indexed": true,
7
- "internalType": "address",
8
- "name": "bridger",
9
- "type": "address"
10
- },
11
- {
12
- "components": [
13
- {
14
- "components": [
15
- {
16
- "internalType": "address",
17
- "name": "sourceToken",
18
- "type": "address"
19
- },
20
- {
21
- "internalType": "address",
22
- "name": "targetToken",
23
- "type": "address"
24
- },
25
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
26
- ],
27
- "internalType": "struct InteropXContractBeta.TokenInfo[]",
28
- "name": "supply",
29
- "type": "tuple[]"
30
- },
31
- {
32
- "components": [
33
- {
34
- "internalType": "address",
35
- "name": "sourceToken",
36
- "type": "address"
37
- },
38
- {
39
- "internalType": "address",
40
- "name": "targetToken",
41
- "type": "address"
42
- },
43
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
44
- ],
45
- "internalType": "struct InteropXContractBeta.TokenInfo[]",
46
- "name": "withdraw",
47
- "type": "tuple[]"
48
- }
49
- ],
50
- "indexed": false,
51
- "internalType": "struct InteropXContractBeta.Position",
52
- "name": "position",
53
- "type": "tuple"
54
- },
55
- {
56
- "indexed": true,
57
- "internalType": "uint32",
58
- "name": "sourceChainId",
59
- "type": "uint32"
60
- },
61
- {
62
- "indexed": false,
63
- "internalType": "uint32",
64
- "name": "targetChainId",
65
- "type": "uint32"
66
- },
67
- {
68
- "indexed": true,
69
- "internalType": "bytes32",
70
- "name": "requestTransactionHash",
71
- "type": "bytes32"
72
- },
73
- {
74
- "indexed": false,
75
- "internalType": "bytes",
76
- "name": "metadata",
77
- "type": "bytes"
78
- }
79
- ],
80
- "name": "LogBridgeCommitted",
81
- "type": "event"
82
- },
83
- {
84
- "anonymous": false,
85
- "inputs": [
86
- {
87
- "indexed": true,
88
- "internalType": "address",
89
- "name": "bridger",
90
- "type": "address"
91
- },
92
- {
93
- "components": [
94
- {
95
- "components": [
96
- {
97
- "internalType": "address",
98
- "name": "sourceToken",
99
- "type": "address"
100
- },
101
- {
102
- "internalType": "address",
103
- "name": "targetToken",
104
- "type": "address"
105
- },
106
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
107
- ],
108
- "internalType": "struct InteropXContractBeta.TokenInfo[]",
109
- "name": "supply",
110
- "type": "tuple[]"
111
- },
112
- {
113
- "components": [
114
- {
115
- "internalType": "address",
116
- "name": "sourceToken",
117
- "type": "address"
118
- },
119
- {
120
- "internalType": "address",
121
- "name": "targetToken",
122
- "type": "address"
123
- },
124
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
125
- ],
126
- "internalType": "struct InteropXContractBeta.TokenInfo[]",
127
- "name": "withdraw",
128
- "type": "tuple[]"
129
- }
130
- ],
131
- "indexed": false,
132
- "internalType": "struct InteropXContractBeta.Position",
133
- "name": "position",
134
- "type": "tuple"
135
- },
136
- {
137
- "indexed": false,
138
- "internalType": "uint256",
139
- "name": "sourceChainId",
140
- "type": "uint256"
141
- },
142
- {
143
- "indexed": true,
144
- "internalType": "uint256",
145
- "name": "targetChainId",
146
- "type": "uint256"
147
- },
148
- {
149
- "indexed": true,
150
- "internalType": "bytes32",
151
- "name": "requestTransactionHash",
152
- "type": "bytes32"
153
- },
154
- {
155
- "indexed": false,
156
- "internalType": "bytes32",
157
- "name": "targetCommittedTransactionHash",
158
- "type": "bytes32"
159
- },
160
- {
161
- "indexed": false,
162
- "internalType": "bytes",
163
- "name": "metadata",
164
- "type": "bytes"
165
- }
166
- ],
167
- "name": "LogBridgeCompleted",
168
- "type": "event"
169
- },
170
- {
171
- "anonymous": false,
172
- "inputs": [
173
- {
174
- "indexed": true,
175
- "internalType": "address",
176
- "name": "bridger",
177
- "type": "address"
178
- },
179
- {
180
- "components": [
181
- {
182
- "components": [
183
- {
184
- "internalType": "address",
185
- "name": "sourceToken",
186
- "type": "address"
187
- },
188
- {
189
- "internalType": "address",
190
- "name": "targetToken",
191
- "type": "address"
192
- },
193
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
194
- ],
195
- "internalType": "struct InteropXContractBeta.TokenInfo[]",
196
- "name": "supply",
197
- "type": "tuple[]"
198
- },
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": "withdraw",
215
- "type": "tuple[]"
216
- }
217
- ],
218
- "indexed": false,
219
- "internalType": "struct InteropXContractBeta.Position",
220
- "name": "position",
221
- "type": "tuple"
222
- },
223
- {
224
- "indexed": false,
225
- "internalType": "uint256",
226
- "name": "sourceChainId",
227
- "type": "uint256"
228
- },
229
- {
230
- "indexed": true,
231
- "internalType": "uint256",
232
- "name": "targetChainId",
233
- "type": "uint256"
234
- },
235
- {
236
- "indexed": false,
237
- "internalType": "bytes",
238
- "name": "metadata",
239
- "type": "bytes"
240
- }
241
- ],
242
- "name": "LogBridgeRequest",
243
- "type": "event"
244
- },
245
- {
246
- "anonymous": false,
247
- "inputs": [
248
- {
249
- "indexed": true,
250
- "internalType": "address",
251
- "name": "bridger",
252
- "type": "address"
253
- },
254
- {
255
- "components": [
256
- {
257
- "components": [
258
- {
259
- "internalType": "address",
260
- "name": "sourceToken",
261
- "type": "address"
262
- },
263
- {
264
- "internalType": "address",
265
- "name": "targetToken",
266
- "type": "address"
267
- },
268
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
269
- ],
270
- "internalType": "struct InteropXContractBeta.TokenInfo[]",
271
- "name": "supply",
272
- "type": "tuple[]"
273
- },
274
- {
275
- "components": [
276
- {
277
- "internalType": "address",
278
- "name": "sourceToken",
279
- "type": "address"
280
- },
281
- {
282
- "internalType": "address",
283
- "name": "targetToken",
284
- "type": "address"
285
- },
286
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
287
- ],
288
- "internalType": "struct InteropXContractBeta.TokenInfo[]",
289
- "name": "withdraw",
290
- "type": "tuple[]"
291
- }
292
- ],
293
- "indexed": false,
294
- "internalType": "struct InteropXContractBeta.Position",
295
- "name": "position",
296
- "type": "tuple"
297
- },
298
- {
299
- "indexed": false,
300
- "internalType": "uint32",
301
- "name": "sourceChainId",
302
- "type": "uint32"
303
- },
304
- {
305
- "indexed": true,
306
- "internalType": "uint32",
307
- "name": "targetChainId",
308
- "type": "uint32"
309
- },
310
- {
311
- "indexed": true,
312
- "internalType": "bytes32",
313
- "name": "requestTransactionHash",
314
- "type": "bytes32"
315
- },
316
- {
317
- "indexed": false,
318
- "internalType": "bytes",
319
- "name": "metadata",
320
- "type": "bytes"
321
- }
322
- ],
323
- "name": "LogBridgeRequestSent",
324
- "type": "event"
325
- },
326
- {
327
- "inputs": [],
328
- "name": "_vnonce",
329
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
330
- "stateMutability": "view",
331
- "type": "function"
332
- },
333
- {
334
- "inputs": [
335
- { "internalType": "address", "name": "to_", "type": "address" },
336
- { "internalType": "address", "name": "sourceToken_", "type": "address" },
337
- { "internalType": "address", "name": "targetToken_", "type": "address" },
338
- { "internalType": "uint256", "name": "amount_", "type": "uint256" },
339
- { "internalType": "uint32", "name": "targetChainId_", "type": "uint32" },
340
- {
341
- "internalType": "bytes32",
342
- "name": "transactionHash_",
343
- "type": "bytes32"
344
- },
345
- { "internalType": "bytes", "name": "metadata_", "type": "bytes" }
346
- ],
347
- "name": "completeBridge",
348
- "outputs": [],
349
- "stateMutability": "nonpayable",
350
- "type": "function"
351
- },
352
- {
353
- "inputs": [
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": "targetChainId_", "type": "uint32" },
358
- { "internalType": "bytes", "name": "metadata_", "type": "bytes" }
359
- ],
360
- "name": "requestWithdraw",
361
- "outputs": [],
362
- "stateMutability": "nonpayable",
363
- "type": "function"
364
- },
365
- {
366
- "inputs": [{ "internalType": "address", "name": "", "type": "address" }],
367
- "name": "whitelistedMapping",
368
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
369
- "stateMutability": "view",
370
- "type": "function"
371
- },
372
- {
373
- "inputs": [
374
- { "internalType": "address", "name": "user_", "type": "address" },
375
- { "internalType": "address", "name": "sourceToken_", "type": "address" },
376
- { "internalType": "address", "name": "targetToken_", "type": "address" },
377
- { "internalType": "uint256", "name": "amount_", "type": "uint256" },
378
- { "internalType": "uint32", "name": "chainId_", "type": "uint32" },
379
- {
380
- "internalType": "bytes32",
381
- "name": "transactionHash_",
382
- "type": "bytes32"
383
- },
384
- { "internalType": "bytes", "name": "metadata_", "type": "bytes" }
385
- ],
386
- "name": "withdrawRequested",
387
- "outputs": [],
388
- "stateMutability": "nonpayable",
389
- "type": "function"
390
- }
391
- ]
@@ -1,41 +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.action !== 'withdraw') {
16
- throw new Error(`Invalid action: ${transaction.action}`);
17
- }
18
- if (type !== 'source') {
19
- throw new Error(`Type not supported: ${type}`);
20
- }
21
- if (transaction.action === 'withdraw' && transaction.sourceStatus === 'pending') {
22
- throw Error('Cannot build data for pending withdraw transaction');
23
- }
24
- if (!transaction.requestEvent) {
25
- throw Error('Cannot build data for transaction without requestEvent');
26
- }
27
- const { bridger, position, sourceChainId, targetChainId, metadata, } = transaction.requestEvent;
28
- const sourceChainProvider = new ethers_1.ethers.providers.JsonRpcProvider((0, utils_1.getRpcProviderUrl)(targetChainId));
29
- const sourceWallet = new ethers_1.ethers.Wallet(config_1.default.privateKey, sourceChainProvider);
30
- const contractAddress = constants_1.addresses[sourceChainId].interopXContract;
31
- const contract = (0, utils_1.getContract)(contractAddress, abi_1.default.interopXContract, sourceWallet);
32
- const { data } = await contract.populateTransaction.withdrawRequested(bridger, position.withdraw[0].sourceToken, position.withdraw[0].targetToken, position.withdraw[0].amount, targetChainId, transaction.requestTransactionHash, metadata);
33
- transactions.push({
34
- to: contractAddress,
35
- data: data,
36
- value: '0',
37
- operation: ethers_multisend_1.OperationType.Call,
38
- });
39
- return { transactions, logs };
40
- }
41
- exports.default = default_1;
@@ -1,146 +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));
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
- const receipt = await txSent.wait();
112
- const parsedLogs = [];
113
- receipt.logs.forEach((log) => {
114
- try {
115
- parsedLogs.push(this.safeContract.interface.parseLog(log));
116
- }
117
- catch (e) { }
118
- });
119
- if (parsedLogs.find(e => e.name === 'ExecutionSuccess')) {
120
- console.log('ExecutionSuccess');
121
- transaction.targetStatus = 'success';
122
- transaction.targetTransactionHash = txSent.hash;
123
- transaction.targetLogs = logs;
124
- transaction.status = 'success';
125
- await transaction.save();
126
- }
127
- else {
128
- console.log('ExecutionFailure');
129
- transaction.targetStatus = 'failed';
130
- transaction.targetTransactionHash = txSent.hash;
131
- transaction.status = 'failed';
132
- await transaction.save();
133
- }
134
- net_1.protocol.sendTransaction(transaction);
135
- }
136
- async start() {
137
- this.contractAddress = constants_1.addresses[this.chainId].interopXContract;
138
- this.provider = new ethers_1.ethers.providers.JsonRpcProvider((0, utils_1.getRpcProviderUrl)(this.chainId));
139
- this.sourceWallet = new ethers_1.ethers.Wallet(config_1.default.privateKey, this.provider);
140
- this.contract = (0, utils_1.getContract)(this.contractAddress, abi_1.default.interopXContract, this.sourceWallet);
141
- this.safeContractAddress = constants_1.addresses[this.chainId].gnosisSafe;
142
- this.safeContract = (0, utils_1.getContract)(this.safeContractAddress, abi_1.default.gnosisSafe, this.sourceWallet);
143
- await super.start();
144
- }
145
- }
146
- exports.default = ProccessBridgeRequestEvents;