@instadapp/interop-x 0.0.0-dev.de23e71 → 0.0.0-dev.e33810b

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 (69) hide show
  1. package/dist/package.json +13 -12
  2. package/dist/src/abi/index.js +2 -4
  3. package/dist/src/abi/interopXContract.json +454 -0
  4. package/dist/src/constants/addresses.js +3 -3
  5. package/dist/src/constants/index.js +0 -1
  6. package/dist/src/constants/tokens.js +31 -1
  7. package/dist/src/db/models/transaction.js +19 -11
  8. package/dist/src/gnosis/actions/index.js +0 -2
  9. package/dist/src/gnosis/actions/withdraw/index.js +55 -0
  10. package/dist/src/gnosis/index.js +4 -4
  11. package/dist/src/index.js +4 -2
  12. package/dist/src/net/protocol/dial/SignatureDialProtocol.js +6 -2
  13. package/dist/src/tasks/{InteropBridge/ProcessWithdrawEvents.js → InteropXContract/ProcessBridgeRequestEvents.js} +42 -52
  14. package/dist/src/tasks/InteropXContract/SyncBridgeRequestEvents.js +78 -0
  15. package/dist/src/tasks/InteropXContract/SyncBridgeRequestSentEvents.js +90 -0
  16. package/dist/src/tasks/index.js +13 -30
  17. package/dist/src/typechain/{InteropBridgeToken.js → InteropXContract.js} +0 -0
  18. package/dist/src/typechain/factories/InteropXContract__factory.js +635 -0
  19. package/dist/src/typechain/factories/index.js +3 -5
  20. package/dist/src/typechain/index.js +3 -5
  21. package/dist/src/utils/index.js +37 -8
  22. package/package.json +13 -12
  23. package/src/abi/index.ts +2 -4
  24. package/src/abi/interopXContract.json +454 -0
  25. package/src/constants/addresses.ts +3 -3
  26. package/src/constants/index.ts +0 -1
  27. package/src/constants/tokens.ts +32 -2
  28. package/src/db/models/transaction.ts +58 -27
  29. package/src/gnosis/actions/index.ts +0 -2
  30. package/src/gnosis/actions/withdraw/index.ts +77 -0
  31. package/src/gnosis/index.ts +5 -5
  32. package/src/index.ts +3 -1
  33. package/src/net/protocol/dial/SignatureDialProtocol.ts +6 -2
  34. package/src/tasks/{InteropBridge/ProcessWithdrawEvents.ts → InteropXContract/ProcessBridgeRequestEvents.ts} +66 -99
  35. package/src/tasks/InteropXContract/SyncBridgeRequestEvents.ts +115 -0
  36. package/src/tasks/InteropXContract/SyncBridgeRequestSentEvents.ts +121 -0
  37. package/src/tasks/index.ts +15 -37
  38. package/src/typechain/InteropXContract.ts +680 -0
  39. package/src/typechain/factories/InteropXContract__factory.ts +642 -0
  40. package/src/typechain/factories/index.ts +1 -2
  41. package/src/typechain/index.ts +2 -4
  42. package/src/utils/index.ts +78 -8
  43. package/dist/src/abi/interopBridgeToken.json +0 -298
  44. package/dist/src/abi/interopXGateway.json +0 -184
  45. package/dist/src/constants/itokens.js +0 -13
  46. package/dist/src/gnosis/actions/deposit.js +0 -48
  47. package/dist/src/gnosis/actions/withdraw.js +0 -50
  48. package/dist/src/tasks/InteropBridge/SyncBurnEvents.js +0 -71
  49. package/dist/src/tasks/InteropBridge/SyncMintEvents.js +0 -67
  50. package/dist/src/tasks/InteropXGateway/ProcessDepositEvents.js +0 -164
  51. package/dist/src/tasks/InteropXGateway/SyncDepositEvents.js +0 -74
  52. package/dist/src/tasks/InteropXGateway/SyncWithdrawtEvents.js +0 -72
  53. package/dist/src/typechain/InteropXGateway.js +0 -2
  54. package/dist/src/typechain/factories/InteropBridgeToken__factory.js +0 -471
  55. package/dist/src/typechain/factories/InteropXGateway__factory.js +0 -265
  56. package/src/abi/interopBridgeToken.json +0 -298
  57. package/src/abi/interopXGateway.json +0 -184
  58. package/src/constants/itokens.ts +0 -10
  59. package/src/gnosis/actions/deposit.ts +0 -63
  60. package/src/gnosis/actions/withdraw.ts +0 -67
  61. package/src/tasks/InteropBridge/SyncBurnEvents.ts +0 -119
  62. package/src/tasks/InteropBridge/SyncMintEvents.ts +0 -99
  63. package/src/tasks/InteropXGateway/ProcessDepositEvents.ts +0 -260
  64. package/src/tasks/InteropXGateway/SyncDepositEvents.ts +0 -124
  65. package/src/tasks/InteropXGateway/SyncWithdrawtEvents.ts +0 -105
  66. package/src/typechain/InteropBridgeToken.ts +0 -692
  67. package/src/typechain/InteropXGateway.ts +0 -407
  68. package/src/typechain/factories/InteropBridgeToken__factory.ts +0 -478
  69. package/src/typechain/factories/InteropXGateway__factory.ts +0 -272
@@ -1,67 +1,33 @@
1
1
  import { BaseTask } from "../BaseTask";
2
2
  import Logger from '@/logger';
3
- import { BigNumber, ethers } from "ethers";
3
+ import { ethers, Wallet } from "ethers";
4
4
  import abi from "@/abi";
5
5
  import { Transaction } from "@/db";
6
- import { buildSignatureBytes, getContract, getRpcProviderUrl, Signature } from "@/utils";
6
+ import { buildSignatureBytes, generateGnosisTransaction, generateInteropTransactionHash, getContract, getRpcProviderUrl, Signature } from "@/utils";
7
7
  import { addresses } from "@/constants";
8
+ import { Op } from "sequelize";
8
9
  import { ChainId } from "@/types";
9
10
  import config from "@/config";
10
- import { GnosisSafe } from "@/typechain";
11
- import { Op } from "sequelize";
11
+ import { GnosisSafe, InteropXContract } from "@/typechain";
12
12
  import wait from "waait";
13
+ import { buildGnosisAction } from "@/gnosis";
13
14
  import { peerPool, protocol } from "@/net";
14
15
  import { LogDescription } from "ethers/lib/utils";
15
- import { buildGnosisAction } from "@/gnosis";
16
-
17
- const generateGnosisTransaction = async (transactionData: any, safeContract: GnosisSafe) => {
18
- console.log(transactionData);
19
-
20
- let isExecuted = await safeContract.dataHashes(
21
- await safeContract.getTransactionHash(
22
- transactionData.to,
23
- transactionData.value,
24
- transactionData.data,
25
- transactionData.operation,
26
- transactionData.safeTxGas,
27
- transactionData.baseGas,
28
- transactionData.gasPrice,
29
- transactionData.gasToken,
30
- transactionData.refundReceiver,
31
- transactionData.nonce
32
- )
33
- )
34
-
35
- while (isExecuted == 1) {
36
- transactionData.safeTxGas = BigNumber.from(String(transactionData.safeTxGas)).add(1).toString()
37
-
38
- isExecuted = await safeContract.dataHashes(
39
- await safeContract.getTransactionHash(
40
- transactionData.to,
41
- transactionData.value,
42
- transactionData.data,
43
- transactionData.operation,
44
- transactionData.safeTxGas,
45
- transactionData.baseGas,
46
- transactionData.gasPrice,
47
- transactionData.gasToken,
48
- transactionData.refundReceiver,
49
- transactionData.nonce
50
- )
51
- )
52
- }
53
-
54
- return transactionData
55
- }
56
16
 
57
- class ProcessWithdrawEvents extends BaseTask {
17
+ class ProccessBridgeRequestEvents extends BaseTask {
18
+ contractAddress: string;
19
+ safeContractAddress: string;
58
20
  provider: ethers.providers.JsonRpcProvider;
21
+ contract: InteropXContract;
22
+ safeContract: GnosisSafe;
59
23
  chainId: ChainId;
60
- leadNodeOnly = true
24
+ sourceWallet: Wallet;
25
+
26
+ leadNodeOnly: boolean = true;
61
27
 
62
28
  constructor({ chainId }: { chainId: ChainId }) {
63
29
  super({
64
- logger: new Logger("InteropXGateway::ProcessWithdrawEvents"),
30
+ logger: new Logger("InteropXContract::ProccessBridgeRequestEvents"),
65
31
  })
66
32
  this.chainId = chainId;
67
33
  }
@@ -72,19 +38,17 @@ class ProcessWithdrawEvents extends BaseTask {
72
38
  const transaction = await Transaction.findOne({
73
39
  where: {
74
40
  status: 'pending',
75
- sourceStatus: 'success',
76
- targetStatus: 'uninitialised',
77
- action: 'withdraw',
78
- sourceCreatedAt: {
41
+ sourceStatus: 'uninitialised',
42
+ createdAt: {
79
43
  [Op.gte]: new Date(Date.now() - 12 * 60 * 60 * 1000),
80
44
  },
81
- targetDelayUntil: {
45
+ sourceDelayUntil: {
82
46
  [Op.or]: {
83
47
  [Op.is]: null,
84
48
  [Op.lt]: new Date(),
85
49
  }
86
50
  },
87
- sourceBlockNumber: {
51
+ requestBlockNumber: {
88
52
  [Op.lt]: blockNumber - 12,
89
53
  },
90
54
  sourceChainId: this.chainId,
@@ -100,34 +64,21 @@ class ProcessWithdrawEvents extends BaseTask {
100
64
  transaction.targetStatus = 'pending';
101
65
  await transaction.save();
102
66
 
103
- // refresh event data?
104
-
105
- const targetChainProvider = new ethers.providers.JsonRpcProvider(
106
- getRpcProviderUrl(transaction.targetChainId as ChainId)
107
- );
108
-
109
- const targetWallet = new ethers.Wallet(config.privateKey!, targetChainProvider);
110
-
111
- const safeAddress = addresses[transaction.targetChainId].gnosisSafe;
112
-
113
-
114
- const safeContract = getContract<GnosisSafe>(
115
- safeAddress,
116
- abi.gnosisSafe,
117
- targetWallet
118
- )
119
-
120
- const ownersThreshold = await safeContract.getThreshold();
67
+ const ownersThreshold = await this.safeContract.getThreshold();
121
68
  await wait(10000);
122
69
 
70
+
123
71
  let data, logs = [];
124
72
 
125
73
  try {
126
- ({ data, logs } = await buildGnosisAction(transaction));
74
+ ({ data, logs } = await buildGnosisAction(transaction, 'source'));
75
+
127
76
  } catch (error) {
128
77
  console.log(error);
78
+ transaction.sourceStatus = 'failed';
79
+ transaction.sourceErrors = [error.message];
129
80
  transaction.targetStatus = 'failed';
130
- transaction.targetErrors = [error.message];
81
+
131
82
  transaction.status = 'failed'
132
83
  await transaction.save();
133
84
  protocol.sendTransaction(transaction)
@@ -142,13 +93,13 @@ class ProcessWithdrawEvents extends BaseTask {
142
93
  nonce: '0',
143
94
  operation: "1",
144
95
  refundReceiver: "0x0000000000000000000000000000000000000000",
145
- safeAddress: safeAddress,
96
+ safeAddress: this.safeContractAddress,
146
97
  safeTxGas: "79668",
147
- to: addresses[transaction.targetChainId].multisend,
98
+ to: addresses[transaction.sourceChainId].multisend,
148
99
  value: "0",
149
- }, safeContract);
100
+ }, this.safeContract);
150
101
 
151
- const owners = await safeContract.getOwners().then(owners => owners.map(owner => owner.toLowerCase()));
102
+ const owners = await this.safeContract.getOwners().then(owners => owners.map(owner => owner.toLowerCase()));
152
103
 
153
104
  const ownerPeerIds = peerPool.activePeers.filter(peer => owners.includes(peer.publicAddress.toLowerCase())).map(peer => peer.id)
154
105
 
@@ -170,18 +121,17 @@ class ProcessWithdrawEvents extends BaseTask {
170
121
 
171
122
  if (validSignatures.length === 0 || ownersThreshold.gt(validSignatures.length)) {
172
123
  await transaction.save();
173
- transaction.targetDelayUntil = new Date(Date.now() + 30 * 1000);
174
- transaction.targetStatus = 'uninitialised'
124
+ transaction.sourceDelayUntil = new Date(Date.now() + 30 * 1000);
125
+ transaction.sourceStatus = 'uninitialised'
175
126
 
176
127
  await transaction.save();
177
128
  const errorMessage = signatures.find(s => !!s.error)?.error;
178
129
  throw new Error(`Not enough signatures` + (errorMessage ? `: ${errorMessage}` : ''));
179
130
  }
180
131
 
181
-
182
132
  console.log(`Executing transaction for execution ${transaction.transactionHash}`)
183
133
 
184
- const { data: txData } = await safeContract.populateTransaction.execTransaction(
134
+ const { data: txData } = await this.safeContract.populateTransaction.execTransaction(
185
135
  gnosisTx.to,
186
136
  gnosisTx.value,
187
137
  gnosisTx.data,
@@ -194,20 +144,15 @@ class ProcessWithdrawEvents extends BaseTask {
194
144
  buildSignatureBytes(validSignatures)
195
145
  );
196
146
 
197
- console.log({
198
- from: targetWallet.address,
199
- gasPrice: BigNumber.from(120 * 10 ** 9).toString(),
200
- to: safeAddress,
147
+ const txSent = await this.sourceWallet.sendTransaction({
148
+ from: this.sourceWallet.address,
149
+ gasPrice: ethers.BigNumber.from(120 * 10 ** 9),
150
+ to: this.safeContractAddress,
201
151
  data: txData,
202
152
  })
203
153
 
154
+ console.log(txSent);
204
155
 
205
- const txSent = await targetWallet.sendTransaction({
206
- from: targetWallet.address,
207
- gasPrice: BigNumber.from(120 * 10 ** 9),
208
- to: safeAddress,
209
- data: txData,
210
- })
211
156
 
212
157
  const receipt = await txSent.wait();
213
158
 
@@ -215,21 +160,26 @@ class ProcessWithdrawEvents extends BaseTask {
215
160
 
216
161
  receipt.logs.forEach((log) => {
217
162
  try {
218
- parsedLogs.push(safeContract.interface.parseLog(log));
163
+ parsedLogs.push(this.safeContract.interface.parseLog(log));
219
164
  } catch (e) { }
220
165
  });
221
166
 
222
167
  if (parsedLogs.find(e => e.name === 'ExecutionSuccess')) {
223
168
  console.log('ExecutionSuccess')
224
- transaction.targetStatus = 'success'
225
- transaction.targetTransactionHash = txSent.hash
226
- transaction.targetLogs = logs
169
+ transaction.sourceStatus = 'success'
170
+ if (txSent.blockNumber)
171
+ transaction.sourceBlockNumber = txSent.blockNumber;
172
+ transaction.sourceTransactionHash = txSent.hash
173
+ transaction.sourceLogs = logs;
227
174
  transaction.status = 'success'
228
175
  await transaction.save();
229
176
  } else {
230
177
  console.log('ExecutionFailure')
231
- transaction.targetStatus = 'failed'
232
- transaction.targetTransactionHash = txSent.hash
178
+ transaction.sourceStatus = 'failed'
179
+ if (txSent.blockNumber)
180
+ transaction.sourceBlockNumber = txSent.blockNumber;
181
+ transaction.sourceTransactionHash = txSent.hash
182
+ transaction.sourceTransactionHash = txSent.hash
233
183
  transaction.status = 'failed'
234
184
  await transaction.save();
235
185
  }
@@ -238,12 +188,29 @@ class ProcessWithdrawEvents extends BaseTask {
238
188
  }
239
189
 
240
190
  async start(): Promise<void> {
191
+ this.contractAddress = addresses[this.chainId].interopXContract;
192
+
241
193
  this.provider = new ethers.providers.JsonRpcProvider(
242
194
  getRpcProviderUrl(this.chainId)
243
195
  );
244
196
 
197
+ this.sourceWallet = new ethers.Wallet(config.privateKey!, this.provider);
198
+
199
+ this.contract = getContract<InteropXContract>(
200
+ this.contractAddress,
201
+ abi.interopXContract,
202
+ this.sourceWallet
203
+ );
204
+
205
+ this.safeContractAddress = addresses[this.chainId].gnosisSafe;
206
+ this.safeContract = getContract<GnosisSafe>(
207
+ this.safeContractAddress,
208
+ abi.gnosisSafe,
209
+ this.sourceWallet
210
+ );
211
+
245
212
  await super.start()
246
213
  }
247
214
  }
248
215
 
249
- export default ProcessWithdrawEvents;
216
+ export default ProccessBridgeRequestEvents;
@@ -0,0 +1,115 @@
1
+ import { BaseTask } from "../BaseTask";
2
+ import Logger from '@/logger';
3
+ import { ethers } from "ethers";
4
+ import abi from "@/abi";
5
+ import { Transaction } from "@/db";
6
+ import { generateInteropTransactionHash, getContract, getRpcProviderUrl } from "@/utils";
7
+ import { addresses } from "@/constants";
8
+ import { ChainId } from "@/types";
9
+ import config from "@/config";
10
+ import { InteropXContract } from "@/typechain";
11
+
12
+ class SyncBridgeRequestEvents extends BaseTask {
13
+ contractAddress: string;
14
+ provider: ethers.providers.JsonRpcProvider;
15
+ contract: InteropXContract;
16
+ chainId: ChainId;
17
+
18
+ constructor({ chainId }: { chainId: ChainId }) {
19
+ super({
20
+ logger: new Logger("InteropXContract::SyncBridgeRequestEvents"),
21
+ })
22
+ this.chainId = chainId;
23
+ }
24
+
25
+ async pollHandler() {
26
+ const currentBlock = await this.provider.getBlockNumber();
27
+
28
+ const events = await this.contract.queryFilter(
29
+ this.contract.filters.LogBridgeRequest(),
30
+ currentBlock - 2000,
31
+ currentBlock,
32
+ );
33
+
34
+ let processedEvents = 0;
35
+
36
+ for (const event of events) {
37
+
38
+ try {
39
+ if (!event.args) {
40
+ continue;
41
+ }
42
+
43
+ const { actionId, bridger, position, sourceChainId, targetChainId, metadata } = event.args;
44
+
45
+ const uniqueIdentifier = {
46
+ actionId,
47
+ bridger,
48
+ requestTransactionHash: event.transactionHash,
49
+ sourceChainId: sourceChainId.toNumber(),
50
+ targetChainId: targetChainId.toNumber(),
51
+ }
52
+
53
+ let transactionHash = generateInteropTransactionHash(uniqueIdentifier);
54
+
55
+ const transaction = await Transaction.findOne({ where: { transactionHash } });
56
+
57
+ if (transaction) {
58
+ continue;
59
+ }
60
+
61
+ await Transaction.create({
62
+ transactionHash,
63
+ ...uniqueIdentifier,
64
+ requestBlockNumber: event.blockNumber,
65
+ requestEvent: {
66
+ actionId,
67
+ bridger,
68
+ position: {
69
+ withdraw: position.withdraw.map((v) => ({
70
+ sourceToken: v.sourceToken,
71
+ targetToken: v.targetToken,
72
+ amount: v.amount.toString()
73
+ })),
74
+ supply: position.supply.map((v) => ({
75
+ sourceToken: v.sourceToken,
76
+ targetToken: v.targetToken,
77
+ amount: v.amount.toString()
78
+ })),
79
+ },
80
+ sourceChainId: sourceChainId.toNumber(),
81
+ targetChainId: targetChainId.toNumber(),
82
+ metadata,
83
+ }
84
+ })
85
+
86
+ this.logger.info(
87
+ `New bridge request received: ${transactionHash} `
88
+ );
89
+ } catch (error) {
90
+ this.logger.error(error);
91
+ }
92
+ }
93
+
94
+ if (processedEvents > 0)
95
+ this.logger.info(`${processedEvents} events processed`);
96
+ }
97
+
98
+ async start(): Promise<void> {
99
+ this.contractAddress = addresses[this.chainId].interopXContract;
100
+
101
+ this.provider = new ethers.providers.JsonRpcProvider(
102
+ getRpcProviderUrl(this.chainId)
103
+ );
104
+
105
+ this.contract = getContract<InteropXContract>(
106
+ this.contractAddress,
107
+ abi.interopXContract,
108
+ new ethers.Wallet(config.privateKey!, this.provider)
109
+ );
110
+
111
+ await super.start()
112
+ }
113
+ }
114
+
115
+ export default SyncBridgeRequestEvents;
@@ -0,0 +1,121 @@
1
+ import { BaseTask } from "../BaseTask";
2
+ import Logger from '@/logger';
3
+ import { ethers } from "ethers";
4
+ import abi from "@/abi";
5
+ import { Transaction } from "@/db";
6
+ import { generateInteropTransactionHash, getContract, getRpcProviderUrl } from "@/utils";
7
+ import { addresses } from "@/constants";
8
+ import { ChainId } from "@/types";
9
+ import config from "@/config";
10
+ import { InteropXContract } from "@/typechain";
11
+ import { Op } from "sequelize";
12
+
13
+ class SyncBridgeRequestSentEvents extends BaseTask {
14
+ contractAddress: string;
15
+ provider: ethers.providers.JsonRpcProvider;
16
+ contract: InteropXContract;
17
+ chainId: ChainId;
18
+
19
+ constructor({ chainId }: { chainId: ChainId }) {
20
+ super({
21
+ logger: new Logger("InteropXContract::SyncBridgeRequestSentEvents"),
22
+ })
23
+ this.chainId = chainId;
24
+ }
25
+
26
+ async pollHandler() {
27
+ const currentBlock = await this.provider.getBlockNumber();
28
+
29
+ const events = await this.contract.queryFilter(
30
+ this.contract.filters.LogBridgeRequestSent(),
31
+ currentBlock - 2000,
32
+ currentBlock,
33
+ );
34
+
35
+ let processedEvents = 0;
36
+
37
+ for (const event of events) {
38
+
39
+ try {
40
+ if (!event.args) {
41
+ continue;
42
+ }
43
+
44
+ const { actionId, bridger, position, sourceChainId, targetChainId, requestTransactionHash, metadata } = event.args;
45
+
46
+ const uniqueIdentifier = {
47
+ actionId,
48
+ bridger,
49
+ requestTransactionHash,
50
+ sourceChainId: sourceChainId,
51
+ targetChainId: targetChainId,
52
+ }
53
+
54
+ let transactionHash = generateInteropTransactionHash(uniqueIdentifier);
55
+
56
+ const transaction = await Transaction.findOne({
57
+ where: {
58
+ transactionHash, sourceStatus: {
59
+ [Op.ne]: 'success',
60
+ }
61
+ }
62
+ });
63
+
64
+ if (!transaction) {
65
+ continue;
66
+ }
67
+ transaction.sourceStatus = 'success'
68
+ transaction.sourceBlockNumber = event.blockNumber;
69
+ transaction.sourceTransactionHash = event.transactionHash
70
+ transaction.requestSentEvent = {
71
+ actionId,
72
+ bridger,
73
+ position: {
74
+ withdraw: position.withdraw.map((v) => ({
75
+ sourceToken: v.sourceToken,
76
+ targetToken: v.targetToken,
77
+ amount: v.amount.toString()
78
+ })),
79
+ supply: position.supply.map((v) => ({
80
+ sourceToken: v.sourceToken,
81
+ targetToken: v.targetToken,
82
+ amount: v.amount.toString()
83
+ })),
84
+ },
85
+ sourceChainId: sourceChainId,
86
+ targetChainId: targetChainId,
87
+ metadata,
88
+ requestTransactionHash,
89
+ }
90
+ await transaction.save()
91
+
92
+ this.logger.info(
93
+ `New bridge request sent received: ${transactionHash} `
94
+ );
95
+ } catch (error) {
96
+ this.logger.error(error);
97
+ }
98
+ }
99
+
100
+ if (processedEvents > 0)
101
+ this.logger.info(`${processedEvents} events processed`);
102
+ }
103
+
104
+ async start(): Promise<void> {
105
+ this.contractAddress = addresses[this.chainId].interopXContract;
106
+
107
+ this.provider = new ethers.providers.JsonRpcProvider(
108
+ getRpcProviderUrl(this.chainId)
109
+ );
110
+
111
+ this.contract = getContract<InteropXContract>(
112
+ this.contractAddress,
113
+ abi.interopXContract,
114
+ new ethers.Wallet(config.privateKey!, this.provider)
115
+ );
116
+
117
+ await super.start()
118
+ }
119
+ }
120
+
121
+ export default SyncBridgeRequestSentEvents;
@@ -1,59 +1,37 @@
1
1
  import { BaseTask } from "./BaseTask";
2
- import InteropXGatewayProcessDepositEvents from "./InteropXGateway/ProcessDepositEvents";
3
- import InteropXGatewaySyncDepositEvents from "./InteropXGateway/SyncDepositEvents";
4
- import InteropXGatewaySyncWithdrawEvents from "./InteropXGateway/SyncWithdrawtEvents";
5
-
6
- import InteropBridgeProcessWithdrawEvents from "./InteropBridge/ProcessWithdrawEvents";
7
- import InteropBridgeSyncBurnEvents from "./InteropBridge/SyncBurnEvents";
8
- import InteropBridgeSyncMintEvents from "./InteropBridge/SyncMintEvents";
2
+ import wait from "waait";
9
3
 
10
4
  import SyncTransactionStatusTask from "./Transactions/SyncTransactionStatusTask";
11
5
 
12
6
  import AutoUpdateTask from "./AutoUpdateTask";
13
7
 
8
+ import SyncBridgeRequestEvents from "./InteropXContract/SyncBridgeRequestEvents";
9
+ import ProccessBridgeRequestEvents from "./InteropXContract/ProcessBridgeRequestEvents";
10
+ import SyncBridgeRequestSentEvents from "./InteropXContract/SyncBridgeRequestSentEvents";
11
+
14
12
  export class Tasks {
15
-
13
+
16
14
  tasks: BaseTask[] = [
17
- new SyncTransactionStatusTask(),
15
+ // new SyncTransactionStatusTask(),
18
16
  new AutoUpdateTask(),
19
17
 
20
- // InteropXGateway
21
-
22
- new InteropXGatewaySyncDepositEvents({
23
- chainId: 43114
24
- }),
25
-
26
- new InteropXGatewayProcessDepositEvents({
27
- chainId: 43114
28
- }),
29
-
30
-
31
- new InteropXGatewaySyncWithdrawEvents({
32
- chainId: 43114
33
- }),
34
-
35
-
36
- // InteropBridge
18
+ // InteropXContract
37
19
 
38
- new InteropBridgeProcessWithdrawEvents({
39
- chainId: 137,
40
- }),
20
+ new SyncBridgeRequestEvents({ chainId: 137 }),
21
+ new SyncBridgeRequestEvents({ chainId: 43114 }),
41
22
 
42
- new InteropBridgeSyncMintEvents({
43
- chainId: 137,
44
- itokenAddress: '0x62c0045f3277e7067cacad3c8038eeabb1bd92d1',
45
- }),
23
+ new SyncBridgeRequestSentEvents({ chainId: 137 }),
24
+ new SyncBridgeRequestSentEvents({ chainId: 43114 }),
46
25
 
47
- new InteropBridgeSyncBurnEvents({
48
- chainId: 137,
49
- itokenAddress: '0x62c0045f3277e7067cacad3c8038eeabb1bd92d1',
50
- })
26
+ new ProccessBridgeRequestEvents({ chainId: 137 }),
27
+ new ProccessBridgeRequestEvents({ chainId: 43114 }),
51
28
  ];
52
29
 
53
30
  async start() {
54
31
  for (const task of this.tasks) {
55
32
  try {
56
33
  task.start();
34
+ await wait(1000)
57
35
  } catch (error) {
58
36
  console.error(`Error starting task: ${task.constructor.name}`);
59
37
  }