@instadapp/interop-x 0.0.0-dev.14afa72 → 0.0.0-dev.1dc43c9

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 (79) hide show
  1. package/.github/workflows/ci.yml +19 -0
  2. package/dist/package.json +13 -12
  3. package/dist/src/abi/index.js +2 -4
  4. package/dist/src/abi/interopX.json +1436 -0
  5. package/dist/src/alias.js +10 -0
  6. package/dist/src/api/index.js +1 -1
  7. package/dist/src/constants/addresses.js +2 -7
  8. package/dist/src/constants/index.js +0 -1
  9. package/dist/src/constants/tokens.js +62 -39
  10. package/dist/src/db/models/transaction.js +21 -11
  11. package/dist/src/gnosis/actions/index.js +0 -2
  12. package/dist/src/gnosis/actions/withdraw/index.js +114 -0
  13. package/dist/src/gnosis/index.js +4 -4
  14. package/dist/src/index.js +7 -19
  15. package/dist/src/net/protocol/dial/SignatureDialProtocol.js +6 -2
  16. package/dist/src/net/protocol/dial/TransactionStatusDialProtocol.js +2 -0
  17. package/dist/src/net/protocol/index.js +11 -1
  18. package/dist/src/tasks/InteropX/SyncLogSubmitEvents.js +84 -0
  19. package/dist/src/tasks/Transactions/SyncTransactionStatusTask.js +6 -2
  20. package/dist/src/tasks/index.js +8 -29
  21. package/dist/src/typechain/{InteropBridgeToken.js → InteropX.js} +0 -0
  22. package/dist/src/typechain/factories/InteropX__factory.js +1928 -0
  23. package/dist/src/typechain/factories/index.js +3 -5
  24. package/dist/src/typechain/index.js +3 -5
  25. package/dist/src/utils/index.js +46 -8
  26. package/package.json +13 -12
  27. package/src/abi/index.ts +2 -4
  28. package/src/abi/interopX.json +1436 -0
  29. package/src/alias.ts +6 -0
  30. package/src/api/index.ts +1 -1
  31. package/src/constants/addresses.ts +3 -8
  32. package/src/constants/index.ts +0 -1
  33. package/src/constants/tokens.ts +63 -40
  34. package/src/db/models/transaction.ts +55 -25
  35. package/src/gnosis/actions/index.ts +0 -2
  36. package/src/gnosis/actions/withdraw/index.ts +155 -0
  37. package/src/gnosis/index.ts +5 -5
  38. package/src/index.ts +6 -18
  39. package/src/net/protocol/dial/SignatureDialProtocol.ts +6 -2
  40. package/src/net/protocol/dial/TransactionStatusDialProtocol.ts +3 -1
  41. package/src/net/protocol/index.ts +13 -3
  42. package/src/tasks/InteropX/SyncLogSubmitEvents.ts +136 -0
  43. package/src/tasks/Transactions/SyncTransactionStatusTask.ts +6 -2
  44. package/src/tasks/index.ts +10 -39
  45. package/src/typechain/InteropX.ts +1216 -0
  46. package/src/typechain/factories/InteropX__factory.ts +1932 -0
  47. package/src/typechain/factories/index.ts +1 -2
  48. package/src/typechain/index.ts +2 -4
  49. package/src/utils/index.ts +102 -11
  50. package/tsconfig.json +7 -2
  51. package/dist/src/abi/interopBridgeToken.json +0 -298
  52. package/dist/src/abi/interopXGateway.json +0 -184
  53. package/dist/src/constants/itokens.js +0 -13
  54. package/dist/src/gnosis/actions/deposit.js +0 -48
  55. package/dist/src/gnosis/actions/withdraw.js +0 -50
  56. package/dist/src/tasks/InteropBridge/ProcessWithdrawEvents.js +0 -162
  57. package/dist/src/tasks/InteropBridge/SyncBurnEvents.js +0 -71
  58. package/dist/src/tasks/InteropBridge/SyncMintEvents.js +0 -67
  59. package/dist/src/tasks/InteropXGateway/ProcessDepositEvents.js +0 -164
  60. package/dist/src/tasks/InteropXGateway/SyncDepositEvents.js +0 -74
  61. package/dist/src/tasks/InteropXGateway/SyncWithdrawtEvents.js +0 -72
  62. package/dist/src/typechain/InteropXGateway.js +0 -2
  63. package/dist/src/typechain/factories/InteropBridgeToken__factory.js +0 -471
  64. package/dist/src/typechain/factories/InteropXGateway__factory.js +0 -265
  65. package/src/abi/interopBridgeToken.json +0 -298
  66. package/src/abi/interopXGateway.json +0 -184
  67. package/src/constants/itokens.ts +0 -10
  68. package/src/gnosis/actions/deposit.ts +0 -63
  69. package/src/gnosis/actions/withdraw.ts +0 -67
  70. package/src/tasks/InteropBridge/ProcessWithdrawEvents.ts +0 -249
  71. package/src/tasks/InteropBridge/SyncBurnEvents.ts +0 -119
  72. package/src/tasks/InteropBridge/SyncMintEvents.ts +0 -99
  73. package/src/tasks/InteropXGateway/ProcessDepositEvents.ts +0 -260
  74. package/src/tasks/InteropXGateway/SyncDepositEvents.ts +0 -124
  75. package/src/tasks/InteropXGateway/SyncWithdrawtEvents.ts +0 -105
  76. package/src/typechain/InteropBridgeToken.ts +0 -692
  77. package/src/typechain/InteropXGateway.ts +0 -407
  78. package/src/typechain/factories/InteropBridgeToken__factory.ts +0 -478
  79. package/src/typechain/factories/InteropXGateway__factory.ts +0 -272
@@ -1,72 +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 config_1 = __importDefault(require("@/config"));
14
- class SyncWithdrawEvents extends BaseTask_1.BaseTask {
15
- constructor({ chainId }) {
16
- super({
17
- logger: new logger_1.default("InteropXGateway::SyncWithdrawEvents"),
18
- });
19
- this.chainId = chainId;
20
- }
21
- async pollHandler() {
22
- const currentBlock = await this.provider.getBlockNumber();
23
- const events = await this.contract.queryFilter(this.contract.filters.LogGatewayWithdraw(), currentBlock - 500, currentBlock);
24
- let processedEvents = 0;
25
- for (const event of events) {
26
- try {
27
- if (!event.args) {
28
- continue;
29
- }
30
- const { user, token, amount, sourceChainId, targetChainId, transactionHash } = event.args;
31
- const uniqueIdentifier = {
32
- action: 'withdraw',
33
- submitTransactionHash: transactionHash,
34
- sourceChainId: sourceChainId,
35
- targetChainId: targetChainId,
36
- targetEvent: null
37
- };
38
- const transaction = await db_1.Transaction.findOne({ where: uniqueIdentifier });
39
- if (!transaction) {
40
- return;
41
- }
42
- const tx = await event.getTransaction();
43
- transaction.targetStatus = 'success';
44
- transaction.targetErrors = [];
45
- transaction.targetTransactionHash = tx.hash;
46
- transaction.targetEvent = {
47
- user,
48
- token,
49
- amount: amount.toString(),
50
- sourceChainId,
51
- targetChainId,
52
- transactionHash,
53
- };
54
- transaction.status = 'success';
55
- await transaction.save();
56
- this.logger.info(`Witdraw confirmation received: ${transaction.transactionHash} `);
57
- }
58
- catch (error) {
59
- this.logger.error(error);
60
- }
61
- }
62
- if (processedEvents > 0)
63
- this.logger.info(`${processedEvents} events processed`);
64
- }
65
- async start() {
66
- this.contractAddress = constants_1.addresses[this.chainId].interopXGateway;
67
- this.provider = new ethers_1.ethers.providers.JsonRpcProvider((0, utils_1.getRpcProviderUrl)(this.chainId));
68
- this.contract = (0, utils_1.getContract)(this.contractAddress, abi_1.default.interopXGateway, new ethers_1.ethers.Wallet(config_1.default.privateKey, this.provider));
69
- await super.start();
70
- }
71
- }
72
- exports.default = SyncWithdrawEvents;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,471 +0,0 @@
1
- "use strict";
2
- /* Autogenerated file. Do not edit manually. */
3
- /* tslint:disable */
4
- /* eslint-disable */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.InteropBridgeToken__factory = void 0;
7
- const ethers_1 = require("ethers");
8
- const _abi = [
9
- {
10
- inputs: [
11
- {
12
- internalType: "address",
13
- name: "__owner",
14
- type: "address",
15
- },
16
- ],
17
- stateMutability: "nonpayable",
18
- type: "constructor",
19
- },
20
- {
21
- anonymous: false,
22
- inputs: [
23
- {
24
- indexed: true,
25
- internalType: "address",
26
- name: "owner",
27
- type: "address",
28
- },
29
- {
30
- indexed: true,
31
- internalType: "address",
32
- name: "spender",
33
- type: "address",
34
- },
35
- {
36
- indexed: false,
37
- internalType: "uint256",
38
- name: "value",
39
- type: "uint256",
40
- },
41
- ],
42
- name: "Approval",
43
- type: "event",
44
- },
45
- {
46
- anonymous: false,
47
- inputs: [
48
- {
49
- indexed: true,
50
- internalType: "address",
51
- name: "to",
52
- type: "address",
53
- },
54
- {
55
- indexed: false,
56
- internalType: "uint256",
57
- name: "amount",
58
- type: "uint256",
59
- },
60
- {
61
- indexed: false,
62
- internalType: "uint32",
63
- name: "sourceChainId",
64
- type: "uint32",
65
- },
66
- {
67
- indexed: true,
68
- internalType: "uint32",
69
- name: "targetChainId",
70
- type: "uint32",
71
- },
72
- ],
73
- name: "Burn",
74
- type: "event",
75
- },
76
- {
77
- anonymous: false,
78
- inputs: [
79
- {
80
- indexed: true,
81
- internalType: "address",
82
- name: "to",
83
- type: "address",
84
- },
85
- {
86
- indexed: false,
87
- internalType: "uint256",
88
- name: "amount",
89
- type: "uint256",
90
- },
91
- {
92
- indexed: true,
93
- internalType: "uint32",
94
- name: "sourceChainId",
95
- type: "uint32",
96
- },
97
- {
98
- indexed: false,
99
- internalType: "uint32",
100
- name: "targetChainId",
101
- type: "uint32",
102
- },
103
- {
104
- indexed: true,
105
- internalType: "bytes32",
106
- name: "submitTransactionHash",
107
- type: "bytes32",
108
- },
109
- ],
110
- name: "Mint",
111
- type: "event",
112
- },
113
- {
114
- anonymous: false,
115
- inputs: [
116
- {
117
- indexed: true,
118
- internalType: "address",
119
- name: "previousOwner",
120
- type: "address",
121
- },
122
- {
123
- indexed: true,
124
- internalType: "address",
125
- name: "newOwner",
126
- type: "address",
127
- },
128
- ],
129
- name: "OwnershipTransferred",
130
- type: "event",
131
- },
132
- {
133
- anonymous: false,
134
- inputs: [
135
- {
136
- indexed: true,
137
- internalType: "address",
138
- name: "from",
139
- type: "address",
140
- },
141
- {
142
- indexed: true,
143
- internalType: "address",
144
- name: "to",
145
- type: "address",
146
- },
147
- {
148
- indexed: false,
149
- internalType: "uint256",
150
- name: "value",
151
- type: "uint256",
152
- },
153
- ],
154
- name: "Transfer",
155
- type: "event",
156
- },
157
- {
158
- inputs: [
159
- {
160
- internalType: "address",
161
- name: "owner",
162
- type: "address",
163
- },
164
- {
165
- internalType: "address",
166
- name: "spender",
167
- type: "address",
168
- },
169
- ],
170
- name: "allowance",
171
- outputs: [
172
- {
173
- internalType: "uint256",
174
- name: "",
175
- type: "uint256",
176
- },
177
- ],
178
- stateMutability: "view",
179
- type: "function",
180
- },
181
- {
182
- inputs: [
183
- {
184
- internalType: "address",
185
- name: "spender",
186
- type: "address",
187
- },
188
- {
189
- internalType: "uint256",
190
- name: "amount",
191
- type: "uint256",
192
- },
193
- ],
194
- name: "approve",
195
- outputs: [
196
- {
197
- internalType: "bool",
198
- name: "",
199
- type: "bool",
200
- },
201
- ],
202
- stateMutability: "nonpayable",
203
- type: "function",
204
- },
205
- {
206
- inputs: [
207
- {
208
- internalType: "address",
209
- name: "account",
210
- type: "address",
211
- },
212
- ],
213
- name: "balanceOf",
214
- outputs: [
215
- {
216
- internalType: "uint256",
217
- name: "",
218
- type: "uint256",
219
- },
220
- ],
221
- stateMutability: "view",
222
- type: "function",
223
- },
224
- {
225
- inputs: [
226
- {
227
- internalType: "address",
228
- name: "to",
229
- type: "address",
230
- },
231
- {
232
- internalType: "uint256",
233
- name: "amount",
234
- type: "uint256",
235
- },
236
- {
237
- internalType: "uint32",
238
- name: "chainId",
239
- type: "uint32",
240
- },
241
- ],
242
- name: "burn",
243
- outputs: [],
244
- stateMutability: "nonpayable",
245
- type: "function",
246
- },
247
- {
248
- inputs: [],
249
- name: "decimals",
250
- outputs: [
251
- {
252
- internalType: "uint8",
253
- name: "",
254
- type: "uint8",
255
- },
256
- ],
257
- stateMutability: "view",
258
- type: "function",
259
- },
260
- {
261
- inputs: [
262
- {
263
- internalType: "address",
264
- name: "spender",
265
- type: "address",
266
- },
267
- {
268
- internalType: "uint256",
269
- name: "subtractedValue",
270
- type: "uint256",
271
- },
272
- ],
273
- name: "decreaseAllowance",
274
- outputs: [
275
- {
276
- internalType: "bool",
277
- name: "",
278
- type: "bool",
279
- },
280
- ],
281
- stateMutability: "nonpayable",
282
- type: "function",
283
- },
284
- {
285
- inputs: [
286
- {
287
- internalType: "address",
288
- name: "spender",
289
- type: "address",
290
- },
291
- {
292
- internalType: "uint256",
293
- name: "addedValue",
294
- type: "uint256",
295
- },
296
- ],
297
- name: "increaseAllowance",
298
- outputs: [
299
- {
300
- internalType: "bool",
301
- name: "",
302
- type: "bool",
303
- },
304
- ],
305
- stateMutability: "nonpayable",
306
- type: "function",
307
- },
308
- {
309
- inputs: [
310
- {
311
- internalType: "address",
312
- name: "to",
313
- type: "address",
314
- },
315
- {
316
- internalType: "uint256",
317
- name: "amount",
318
- type: "uint256",
319
- },
320
- {
321
- internalType: "uint32",
322
- name: "chainId",
323
- type: "uint32",
324
- },
325
- {
326
- internalType: "bytes32",
327
- name: "transactionHash",
328
- type: "bytes32",
329
- },
330
- ],
331
- name: "mint",
332
- outputs: [],
333
- stateMutability: "nonpayable",
334
- type: "function",
335
- },
336
- {
337
- inputs: [],
338
- name: "name",
339
- outputs: [
340
- {
341
- internalType: "string",
342
- name: "",
343
- type: "string",
344
- },
345
- ],
346
- stateMutability: "view",
347
- type: "function",
348
- },
349
- {
350
- inputs: [],
351
- name: "owner",
352
- outputs: [
353
- {
354
- internalType: "address",
355
- name: "",
356
- type: "address",
357
- },
358
- ],
359
- stateMutability: "view",
360
- type: "function",
361
- },
362
- {
363
- inputs: [],
364
- name: "renounceOwnership",
365
- outputs: [],
366
- stateMutability: "nonpayable",
367
- type: "function",
368
- },
369
- {
370
- inputs: [],
371
- name: "symbol",
372
- outputs: [
373
- {
374
- internalType: "string",
375
- name: "",
376
- type: "string",
377
- },
378
- ],
379
- stateMutability: "view",
380
- type: "function",
381
- },
382
- {
383
- inputs: [],
384
- name: "totalSupply",
385
- outputs: [
386
- {
387
- internalType: "uint256",
388
- name: "",
389
- type: "uint256",
390
- },
391
- ],
392
- stateMutability: "view",
393
- type: "function",
394
- },
395
- {
396
- inputs: [
397
- {
398
- internalType: "address",
399
- name: "to",
400
- type: "address",
401
- },
402
- {
403
- internalType: "uint256",
404
- name: "amount",
405
- type: "uint256",
406
- },
407
- ],
408
- name: "transfer",
409
- outputs: [
410
- {
411
- internalType: "bool",
412
- name: "",
413
- type: "bool",
414
- },
415
- ],
416
- stateMutability: "nonpayable",
417
- type: "function",
418
- },
419
- {
420
- inputs: [
421
- {
422
- internalType: "address",
423
- name: "from",
424
- type: "address",
425
- },
426
- {
427
- internalType: "address",
428
- name: "to",
429
- type: "address",
430
- },
431
- {
432
- internalType: "uint256",
433
- name: "amount",
434
- type: "uint256",
435
- },
436
- ],
437
- name: "transferFrom",
438
- outputs: [
439
- {
440
- internalType: "bool",
441
- name: "",
442
- type: "bool",
443
- },
444
- ],
445
- stateMutability: "nonpayable",
446
- type: "function",
447
- },
448
- {
449
- inputs: [
450
- {
451
- internalType: "address",
452
- name: "newOwner",
453
- type: "address",
454
- },
455
- ],
456
- name: "transferOwnership",
457
- outputs: [],
458
- stateMutability: "nonpayable",
459
- type: "function",
460
- },
461
- ];
462
- class InteropBridgeToken__factory {
463
- static createInterface() {
464
- return new ethers_1.utils.Interface(_abi);
465
- }
466
- static connect(address, signerOrProvider) {
467
- return new ethers_1.Contract(address, _abi, signerOrProvider);
468
- }
469
- }
470
- exports.InteropBridgeToken__factory = InteropBridgeToken__factory;
471
- InteropBridgeToken__factory.abi = _abi;