@instadapp/interop-x 0.0.0-dev.a775e30 → 0.0.0-dev.a861339
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/package.json +2 -2
- package/dist/src/abi/index.js +2 -4
- package/dist/src/abi/interopXContract.json +391 -0
- package/dist/src/alias.js +10 -0
- package/dist/src/api/index.js +3 -0
- package/dist/src/constants/addresses.js +3 -3
- package/dist/src/constants/index.js +0 -1
- package/dist/src/db/models/transaction.js +27 -9
- package/dist/src/gnosis/actions/index.js +9 -0
- package/dist/src/gnosis/actions/withdraw/index.js +41 -0
- package/dist/src/gnosis/index.js +20 -0
- package/dist/src/index.js +7 -18
- package/dist/src/net/protocol/dial/SignatureDialProtocol.js +9 -10
- package/dist/src/net/protocol/dial/{SignatureDialProtocol.1.js → TransactionStatusDialProtocol.js} +2 -0
- package/dist/src/net/protocol/index.js +17 -7
- package/dist/src/tasks/{InteropXGateway/ProcessDepositEvents.js → InteropXContract/ProcessBridgeRequestEvents.js} +49 -51
- package/dist/src/tasks/InteropXContract/SyncBridgeRequestEvents.js +78 -0
- package/dist/src/tasks/InteropXContract/SyncBridgeRequestSentEvents.js +80 -0
- package/dist/src/tasks/Transactions/SyncTransactionStatusTask.js +2 -0
- package/dist/src/tasks/index.js +13 -19
- package/dist/src/typechain/{InteropBridgeToken.js → InteropXContract.js} +0 -0
- package/dist/src/typechain/factories/InteropXContract__factory.js +526 -0
- package/dist/src/typechain/factories/index.js +3 -5
- package/dist/src/typechain/index.js +3 -5
- package/dist/src/utils/index.js +14 -84
- package/package.json +2 -2
- package/src/abi/index.ts +2 -4
- package/src/abi/interopXContract.json +391 -0
- package/src/alias.ts +6 -0
- package/src/api/index.ts +3 -0
- package/src/constants/addresses.ts +3 -3
- package/src/constants/index.ts +0 -1
- package/src/db/models/transaction.ts +66 -21
- package/src/gnosis/actions/index.ts +5 -0
- package/src/gnosis/actions/withdraw/index.ts +56 -0
- package/src/gnosis/index.ts +19 -0
- package/src/index.ts +6 -17
- package/src/net/protocol/dial/SignatureDialProtocol.ts +11 -13
- package/src/net/protocol/dial/{SignatureDialProtocol.1.ts → TransactionStatusDialProtocol.ts} +3 -1
- package/src/net/protocol/index.ts +17 -7
- package/src/tasks/{InteropBridge/ProcessWithdrawEvents.ts → InteropXContract/ProcessBridgeRequestEvents.ts} +75 -95
- package/src/tasks/InteropXContract/SyncBridgeRequestEvents.ts +116 -0
- package/src/tasks/InteropXContract/SyncBridgeRequestSentEvents.ts +112 -0
- package/src/tasks/Transactions/SyncTransactionStatusTask.ts +2 -0
- package/src/tasks/index.ts +17 -20
- package/src/typechain/InteropXContract.ts +524 -0
- package/src/typechain/factories/InteropXContract__factory.ts +533 -0
- package/src/typechain/factories/index.ts +1 -2
- package/src/typechain/index.ts +2 -4
- package/src/utils/index.ts +46 -125
- package/tsconfig.json +7 -2
- package/dist/src/abi/interopBridgeToken.json +0 -286
- package/dist/src/abi/interopXGateway.json +0 -184
- package/dist/src/constants/itokens.js +0 -13
- package/dist/src/tasks/InteropBridge/ProcessWithdrawEvents.js +0 -146
- package/dist/src/tasks/InteropBridge/SyncWithdrawEvents.js +0 -69
- package/dist/src/tasks/InteropXGateway/SyncDepositEvents.js +0 -74
- package/dist/src/typechain/InteropXGateway.js +0 -2
- package/dist/src/typechain/factories/InteropBridgeToken__factory.js +0 -459
- package/dist/src/typechain/factories/InteropXGateway__factory.js +0 -265
- package/src/abi/interopBridgeToken.json +0 -286
- package/src/abi/interopXGateway.json +0 -184
- package/src/constants/itokens.ts +0 -10
- package/src/tasks/InteropBridge/SyncWithdrawEvents.ts +0 -119
- package/src/tasks/InteropXGateway/ProcessDepositEvents.ts +0 -243
- package/src/tasks/InteropXGateway/SyncDepositEvents.ts +0 -124
- package/src/typechain/InteropBridgeToken.ts +0 -686
- package/src/typechain/InteropXGateway.ts +0 -407
- package/src/typechain/factories/InteropBridgeToken__factory.ts +0 -466
- package/src/typechain/factories/InteropXGateway__factory.ts +0 -272
package/dist/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@instadapp/interop-x",
|
3
|
-
"version": "0.0.0-dev.
|
3
|
+
"version": "0.0.0-dev.a861339",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"engines": {
|
@@ -11,7 +11,7 @@
|
|
11
11
|
"start": "yarn build && node bin/interop-x",
|
12
12
|
"build": "yarn generate-abi-types && export GIT_REF=$(git rev-parse --short HEAD) && rimraf ./dist && tsc -p tsconfig.json && replace-in-file '@GIT_SHORT_HASH@' $GIT_REF ./dist/**/*.js",
|
13
13
|
"dev": "yarn generate-abi-types && NODE_ENV=development nodemon",
|
14
|
-
"generate-abi-types": "typechain --target=ethers-v5 'src/abi/*.json' --out-dir 'src/typechain'",
|
14
|
+
"generate-abi-types": "rimraf src/typechain && typechain --target=ethers-v5 'src/abi/*.json' --out-dir 'src/typechain'",
|
15
15
|
"prepublishOnly": "yarn build",
|
16
16
|
"postinstall": "patch-package"
|
17
17
|
},
|
package/dist/src/abi/index.js
CHANGED
@@ -5,11 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const gnosisSafe_json_1 = __importDefault(require("./gnosisSafe.json"));
|
7
7
|
const erc20_json_1 = __importDefault(require("./erc20.json"));
|
8
|
-
const
|
9
|
-
const interopBridgeToken_json_1 = __importDefault(require("./interopBridgeToken.json"));
|
8
|
+
const interopXContract_json_1 = __importDefault(require("./interopXContract.json"));
|
10
9
|
exports.default = {
|
11
10
|
gnosisSafe: gnosisSafe_json_1.default,
|
12
11
|
erc20: erc20_json_1.default,
|
13
|
-
|
14
|
-
interopBridgeToken: interopBridgeToken_json_1.default,
|
12
|
+
interopXContract: interopXContract_json_1.default,
|
15
13
|
};
|
@@ -0,0 +1,391 @@
|
|
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
|
+
]
|
@@ -0,0 +1,10 @@
|
|
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 module_alias_1 = __importDefault(require("module-alias"));
|
7
|
+
module_alias_1.default.addAliases({
|
8
|
+
"@": __dirname,
|
9
|
+
});
|
10
|
+
(0, module_alias_1.default)();
|
package/dist/src/api/index.js
CHANGED
@@ -5,16 +5,16 @@ exports.addresses = {
|
|
5
5
|
1: {
|
6
6
|
gnosisSafe: '0x811Bff6eF88dAAA0aD6438386B534A81cE3F160F',
|
7
7
|
multisend: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761',
|
8
|
-
|
8
|
+
interopXContract: '',
|
9
9
|
},
|
10
10
|
137: {
|
11
11
|
gnosisSafe: '0x5635d2910e51da33d9DC0422c893CF4F28B69A25',
|
12
12
|
multisend: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761',
|
13
|
-
|
13
|
+
interopXContract: '0x2189741c8cAc1cf51570932817A7d6390646C80e',
|
14
14
|
},
|
15
15
|
43114: {
|
16
16
|
gnosisSafe: '0x31d7a5194Fe60AC209Cf1Ce2d539C9A60662Ed6b',
|
17
17
|
multisend: '0x998739BFdAAdde7C933B942a68053933098f9EDa',
|
18
|
-
|
18
|
+
interopXContract: '0x1867DF97Ec24bb0bbD4AD464F0Be9C6713422EAE',
|
19
19
|
}
|
20
20
|
};
|
@@ -16,4 +16,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
__exportStar(require("./addresses"), exports);
|
18
18
|
__exportStar(require("./tokens"), exports);
|
19
|
-
__exportStar(require("./itokens"), exports);
|
@@ -12,20 +12,26 @@ Transaction.init({
|
|
12
12
|
autoIncrement: true,
|
13
13
|
primaryKey: true
|
14
14
|
},
|
15
|
-
|
16
|
-
|
15
|
+
requestTransactionHash: sequelize_2.DataTypes.NUMBER,
|
16
|
+
requestBlockNumber: sequelize_2.DataTypes.NUMBER,
|
17
17
|
transactionHash: sequelize_2.DataTypes.STRING,
|
18
18
|
action: sequelize_2.DataTypes.STRING,
|
19
|
-
|
20
|
-
to: sequelize_2.DataTypes.STRING,
|
19
|
+
bridger: sequelize_2.DataTypes.STRING,
|
21
20
|
sourceChainId: sequelize_2.DataTypes.NUMBER,
|
22
21
|
sourceTransactionHash: sequelize_2.DataTypes.STRING,
|
23
22
|
sourceBlockNumber: sequelize_2.DataTypes.NUMBER,
|
24
|
-
sourceStatus:
|
23
|
+
sourceStatus: {
|
24
|
+
type: sequelize_2.DataTypes.STRING,
|
25
|
+
defaultValue: 'uninitialised'
|
26
|
+
},
|
25
27
|
sourceErrors: {
|
26
28
|
type: sequelize_2.DataTypes.JSON,
|
27
29
|
// defaultValue: [],
|
28
30
|
},
|
31
|
+
sourceLogs: {
|
32
|
+
type: sequelize_2.DataTypes.JSON,
|
33
|
+
// defaultValue: [],
|
34
|
+
},
|
29
35
|
sourceCreatedAt: {
|
30
36
|
type: sequelize_2.DataTypes.DATE,
|
31
37
|
defaultValue: Date.now()
|
@@ -34,16 +40,28 @@ Transaction.init({
|
|
34
40
|
targetChainId: sequelize_2.DataTypes.NUMBER,
|
35
41
|
targetTransactionHash: sequelize_2.DataTypes.STRING,
|
36
42
|
targetBlockNumber: sequelize_2.DataTypes.NUMBER,
|
37
|
-
targetStatus:
|
43
|
+
targetStatus: {
|
44
|
+
type: sequelize_2.DataTypes.STRING,
|
45
|
+
defaultValue: 'uninitialised'
|
46
|
+
},
|
38
47
|
targetErrors: {
|
39
48
|
type: sequelize_2.DataTypes.JSON,
|
40
49
|
// defaultValue: [],
|
41
50
|
},
|
51
|
+
targetLogs: {
|
52
|
+
type: sequelize_2.DataTypes.JSON,
|
53
|
+
// defaultValue: [],
|
54
|
+
},
|
42
55
|
targetCreatedAt: sequelize_2.DataTypes.DATE,
|
43
56
|
targetDelayUntil: sequelize_2.DataTypes.DATE,
|
44
|
-
|
45
|
-
|
46
|
-
|
57
|
+
requestEvent: {
|
58
|
+
type: sequelize_2.DataTypes.JSON,
|
59
|
+
allowNull: false
|
60
|
+
},
|
61
|
+
requestSentEvent: sequelize_2.DataTypes.JSON,
|
62
|
+
committedEvent: sequelize_2.DataTypes.JSON,
|
63
|
+
completedEvent: sequelize_2.DataTypes.JSON,
|
64
|
+
position: sequelize_2.DataTypes.JSON,
|
47
65
|
metadata: sequelize_2.DataTypes.JSON,
|
48
66
|
status: {
|
49
67
|
type: sequelize_2.DataTypes.STRING,
|
@@ -0,0 +1,9 @@
|
|
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 withdraw_1 = __importDefault(require("./withdraw"));
|
7
|
+
exports.default = {
|
8
|
+
withdraw: withdraw_1.default,
|
9
|
+
};
|
@@ -0,0 +1,41 @@
|
|
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;
|
@@ -0,0 +1,20 @@
|
|
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
|
+
exports.buildGnosisAction = void 0;
|
7
|
+
const ethers_multisend_1 = require("ethers-multisend");
|
8
|
+
const actions_1 = __importDefault(require("./actions"));
|
9
|
+
const buildGnosisAction = async (transaction, type) => {
|
10
|
+
// type = type || (transaction.sourceStatus === 'success' ? 'target' : 'source')
|
11
|
+
if (actions_1.default.hasOwnProperty(transaction.action)) {
|
12
|
+
const { transactions, logs } = await actions_1.default[transaction.action](transaction, type);
|
13
|
+
return {
|
14
|
+
data: (0, ethers_multisend_1.encodeMulti)(transactions).data,
|
15
|
+
logs
|
16
|
+
};
|
17
|
+
}
|
18
|
+
throw new Error(`Unknown action: ${transaction.action}`);
|
19
|
+
};
|
20
|
+
exports.buildGnosisAction = buildGnosisAction;
|
package/dist/src/index.js
CHANGED
@@ -3,24 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
|
6
|
+
require("./alias");
|
7
7
|
const expand_home_dir_1 = __importDefault(require("expand-home-dir"));
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
9
|
-
module_alias_1.default.addAliases({
|
10
|
-
"@/": __dirname + "/",
|
11
|
-
"@/logger": __dirname + "/logger",
|
12
|
-
"@/tasks": __dirname + "/tasks",
|
13
|
-
"@/utils": __dirname + "/utils",
|
14
|
-
"@/api": __dirname + "/api",
|
15
|
-
"@/net": __dirname + "/net",
|
16
|
-
"@/db": __dirname + "/db",
|
17
|
-
"@/config": __dirname + "/config",
|
18
|
-
"@/types": __dirname + "/types",
|
19
|
-
"@/abi": __dirname + "/abi",
|
20
|
-
"@/constants": __dirname + "/constants",
|
21
|
-
"@/typechain": __dirname + "/typechain"
|
22
|
-
});
|
23
|
-
(0, module_alias_1.default)();
|
24
9
|
const dotenv_1 = __importDefault(require("dotenv"));
|
25
10
|
const chalk_1 = __importDefault(require("chalk"));
|
26
11
|
const ethers_1 = require("ethers");
|
@@ -28,7 +13,7 @@ const package_json_1 = __importDefault(require("../package.json"));
|
|
28
13
|
dotenv_1.default.config();
|
29
14
|
const logger_1 = __importDefault(require("@/logger"));
|
30
15
|
const logger = new logger_1.default('Process');
|
31
|
-
const GIT_SHORT_HASH = '
|
16
|
+
const GIT_SHORT_HASH = 'a861339';
|
32
17
|
const printUsage = () => {
|
33
18
|
console.log();
|
34
19
|
console.log(`Interop X Node (v${package_json_1.default.version} - rev.${GIT_SHORT_HASH})`);
|
@@ -87,7 +72,9 @@ const utils_1 = require("./utils");
|
|
87
72
|
async function main() {
|
88
73
|
(0, net_1.startPeer)({});
|
89
74
|
const tasks = new tasks_1.Tasks();
|
90
|
-
|
75
|
+
setTimeout(() => {
|
76
|
+
tasks.start();
|
77
|
+
}, 10000);
|
91
78
|
(0, api_1.startApiServer)();
|
92
79
|
net_1.protocol.on('TransactionStatus', async (payload) => {
|
93
80
|
if (!net_1.peerPool.isLeadNode(payload.peerId)) {
|
@@ -105,9 +92,11 @@ async function main() {
|
|
105
92
|
transaction.sourceStatus = payload.data.sourceStatus;
|
106
93
|
transaction.sourceTransactionHash = payload.data.sourceTransactionHash;
|
107
94
|
transaction.sourceErrors = payload.data.sourceErrors;
|
95
|
+
transaction.sourceLogs = payload.data.sourceLogs;
|
108
96
|
transaction.targetStatus = payload.data.targetStatus;
|
109
97
|
transaction.targetTransactionHash = payload.data.targetTransactionHash;
|
110
98
|
transaction.targetErrors = payload.data.targetErrors;
|
99
|
+
transaction.targetLogs = payload.data.targetLogs;
|
111
100
|
transaction.status = payload.data.status;
|
112
101
|
await transaction.save();
|
113
102
|
});
|