@instadapp/interop-x 0.0.0-dev.73e5298 → 0.0.0-dev.7738003

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 (43) hide show
  1. package/.github/workflows/ci.yml +19 -0
  2. package/dist/package.json +1 -1
  3. package/dist/src/abi/index.js +2 -2
  4. package/dist/src/abi/interopX.json +1436 -0
  5. package/dist/src/api/index.js +1 -1
  6. package/dist/src/constants/addresses.js +2 -7
  7. package/dist/src/db/models/transaction.js +11 -9
  8. package/dist/src/gnosis/actions/withdraw/index.js +106 -107
  9. package/dist/src/index.js +1 -1
  10. package/dist/src/tasks/{InteropXContract/SyncBridgeRequestEvents.js → InteropX/SyncLogSubmitEvents.js} +18 -12
  11. package/dist/src/tasks/Transactions/SyncTransactionStatusTask.js +3 -3
  12. package/dist/src/tasks/index.js +4 -13
  13. package/dist/src/typechain/{InteropXContract.js → InteropX.js} +0 -0
  14. package/dist/src/typechain/factories/InteropX__factory.js +1928 -0
  15. package/dist/src/typechain/factories/index.js +3 -3
  16. package/dist/src/typechain/index.js +3 -3
  17. package/dist/src/utils/index.js +5 -3
  18. package/package.json +1 -1
  19. package/src/abi/index.ts +2 -2
  20. package/src/abi/interopX.json +1436 -0
  21. package/src/api/index.ts +1 -1
  22. package/src/constants/addresses.ts +3 -8
  23. package/src/db/models/transaction.ts +28 -37
  24. package/src/gnosis/actions/withdraw/index.ts +131 -131
  25. package/src/tasks/{InteropXContract/SyncBridgeRequestEvents.ts → InteropX/SyncLogSubmitEvents.ts} +37 -16
  26. package/src/tasks/Transactions/SyncTransactionStatusTask.ts +3 -3
  27. package/src/tasks/index.ts +5 -17
  28. package/src/typechain/InteropX.ts +1216 -0
  29. package/src/typechain/factories/InteropX__factory.ts +1932 -0
  30. package/src/typechain/factories/index.ts +1 -1
  31. package/src/typechain/index.ts +2 -2
  32. package/src/utils/index.ts +22 -8
  33. package/dist/src/abi/interopXContract.json +0 -454
  34. package/dist/src/tasks/InteropXContract/ProcessBridgeRequestEvents.js +0 -158
  35. package/dist/src/tasks/InteropXContract/SyncBridgeCommittedEvents.js +0 -93
  36. package/dist/src/tasks/InteropXContract/SyncBridgeRequestSentEvents.js +0 -90
  37. package/dist/src/typechain/factories/InteropXContract__factory.js +0 -635
  38. package/src/abi/interopXContract.json +0 -454
  39. package/src/tasks/InteropXContract/ProcessBridgeRequestEvents.ts +0 -226
  40. package/src/tasks/InteropXContract/SyncBridgeCommittedEvents.ts +0 -125
  41. package/src/tasks/InteropXContract/SyncBridgeRequestSentEvents.ts +0 -121
  42. package/src/typechain/InteropXContract.ts +0 -680
  43. package/src/typechain/factories/InteropXContract__factory.ts +0 -642
@@ -21,7 +21,7 @@ const startApiServer = async () => {
21
21
  limit: 20,
22
22
  offset: 0,
23
23
  order: [
24
- ['createdAt', 'DESC']
24
+ ['updatedAt', 'DESC']
25
25
  ]
26
26
  });
27
27
  });
@@ -2,19 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addresses = void 0;
4
4
  exports.addresses = {
5
- // 1: {
6
- // gnosisSafe: '0x811Bff6eF88dAAA0aD6438386B534A81cE3F160F',
7
- // multisend: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761',
8
- // interopXContract: '',
9
- // },
10
5
  137: {
11
6
  gnosisSafe: '0x5635d2910e51da33d9DC0422c893CF4F28B69A25',
12
7
  multisend: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761',
13
- interopXContract: '0x65AcB77B5191CED1B1ae85B454D20E2d128fAfEe',
8
+ interopX: '0xDB6083df37C5F224a3dF84A4B5f9fB60b6c8670a',
14
9
  },
15
10
  43114: {
16
11
  gnosisSafe: '0x31d7a5194Fe60AC209Cf1Ce2d539C9A60662Ed6b',
17
12
  multisend: '0x998739BFdAAdde7C933B942a68053933098f9EDa',
18
- interopXContract: '0xd61f55C6d9deD35B9d13243b816c4BcC1d78592b',
13
+ interopX: '0xd61f55C6d9deD35B9d13243b816c4BcC1d78592b',
19
14
  }
20
15
  };
@@ -12,17 +12,21 @@ Transaction.init({
12
12
  autoIncrement: true,
13
13
  primaryKey: true
14
14
  },
15
- requestTransactionHash: sequelize_2.DataTypes.NUMBER,
16
- requestBlockNumber: sequelize_2.DataTypes.NUMBER,
17
15
  transactionHash: sequelize_2.DataTypes.STRING,
18
16
  actionId: sequelize_2.DataTypes.STRING,
19
- bridger: sequelize_2.DataTypes.STRING,
17
+ vnonce: sequelize_2.DataTypes.STRING,
18
+ sourceSender: sequelize_2.DataTypes.STRING,
19
+ submitChainId: sequelize_2.DataTypes.NUMBER,
20
+ submitTransactionHash: sequelize_2.DataTypes.STRING,
21
+ submitBlockNumber: sequelize_2.DataTypes.NUMBER,
22
+ submitCreatedAt: sequelize_2.DataTypes.DATE,
20
23
  sourceChainId: sequelize_2.DataTypes.NUMBER,
24
+ sourceDsaId: sequelize_2.DataTypes.STRING,
21
25
  sourceTransactionHash: sequelize_2.DataTypes.STRING,
22
26
  sourceBlockNumber: sequelize_2.DataTypes.NUMBER,
23
27
  sourceStatus: {
24
28
  type: sequelize_2.DataTypes.STRING,
25
- defaultValue: 'uninitialised'
29
+ defaultValue: 'pending'
26
30
  },
27
31
  sourceErrors: {
28
32
  type: sequelize_2.DataTypes.JSON,
@@ -38,11 +42,12 @@ Transaction.init({
38
42
  },
39
43
  sourceDelayUntil: sequelize_2.DataTypes.STRING,
40
44
  targetChainId: sequelize_2.DataTypes.NUMBER,
45
+ targetDsaId: sequelize_2.DataTypes.STRING,
41
46
  targetTransactionHash: sequelize_2.DataTypes.STRING,
42
47
  targetBlockNumber: sequelize_2.DataTypes.NUMBER,
43
48
  targetStatus: {
44
49
  type: sequelize_2.DataTypes.STRING,
45
- defaultValue: 'uninitialised'
50
+ defaultValue: 'pending'
46
51
  },
47
52
  targetErrors: {
48
53
  type: sequelize_2.DataTypes.JSON,
@@ -54,13 +59,10 @@ Transaction.init({
54
59
  },
55
60
  targetCreatedAt: sequelize_2.DataTypes.DATE,
56
61
  targetDelayUntil: sequelize_2.DataTypes.DATE,
57
- requestEvent: {
62
+ submitEvent: {
58
63
  type: sequelize_2.DataTypes.JSON,
59
64
  allowNull: false
60
65
  },
61
- requestSentEvent: sequelize_2.DataTypes.JSON,
62
- committedEvent: sequelize_2.DataTypes.JSON,
63
- completedEvent: sequelize_2.DataTypes.JSON,
64
66
  status: {
65
67
  type: sequelize_2.DataTypes.STRING,
66
68
  defaultValue: 'pending'
@@ -1,115 +1,114 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  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
- const getBridgeAmounts = async (user, tokens, chainId) => {
13
- const sourceChainProvider = new ethers_1.ethers.providers.JsonRpcProvider((0, utils_1.getRpcProviderUrl)(chainId));
14
- const sourceWallet = new ethers_1.ethers.Wallet(config_1.default.privateKey, sourceChainProvider);
15
- const contractAddress = constants_1.addresses[chainId].interopXContract;
16
- const contract = (0, utils_1.getContract)(contractAddress, abi_1.default.interopXContract, sourceWallet);
17
- const data = await contract.getBridgeAmounts(user, tokens);
18
- return data.map((item, index) => ({
19
- token: tokens[index],
20
- deposit: item.deposit,
21
- withdraw: item.withdraw,
22
- }));
23
- };
3
+ // const getBridgeAmounts = async (user: string, tokens: string[], chainId: ChainId) => {
4
+ // const sourceChainProvider = new ethers.providers.JsonRpcProvider(getRpcProviderUrl(chainId));
5
+ // const sourceWallet = new ethers.Wallet(config.privateKey, sourceChainProvider);
6
+ // const contractAddress = addresses[chainId].interopX;
7
+ // const contract = getContract<InteropX>(contractAddress, abi.interopX, sourceWallet);
8
+ // const data = await contract.getBridgeAmounts(user, tokens);
9
+ // return data.map((item, index) => ({
10
+ // token: tokens[index],
11
+ // deposit: item.deposit,
12
+ // withdraw: item.withdraw,
13
+ // }))
14
+ // }
24
15
  async function default_1(transaction, type) {
25
16
  const transactions = [];
26
17
  const logs = [];
27
- if (transaction.actionId !== 'withdraw') {
28
- throw new Error(`Invalid action: ${transaction.actionId}`);
29
- }
30
- if (type !== 'source') {
31
- throw new Error(`[WIP] Type not supported: ${type}`);
32
- }
33
- if (transaction.sourceStatus === 'pending') {
34
- throw Error('Source transaction already processesing');
35
- }
36
- if (transaction.sourceStatus === 'pending') {
37
- throw Error('Source transaction already processed');
38
- }
39
- if (!transaction.requestEvent) {
40
- throw Error('Something went wrong, source transaction has no request event');
41
- }
42
- const { actionId, bridger, position, sourceChainId, targetChainId, metadata } = transaction.requestEvent;
43
- const sourceChainProvider = new ethers_1.ethers.providers.JsonRpcProvider((0, utils_1.getRpcProviderUrl)(sourceChainId));
44
- const sourceWallet = new ethers_1.ethers.Wallet(config_1.default.privateKey, sourceChainProvider);
45
- const contractAddress = constants_1.addresses[sourceChainId].interopXContract;
46
- const contract = (0, utils_1.getContract)(contractAddress, abi_1.default.interopXContract, sourceWallet);
47
- const sourceToken = constants_1.tokens[sourceChainId].find(t => t.address.toLowerCase() === position.withdraw[0].sourceToken.toLowerCase());
48
- if (!sourceToken) {
49
- throw Error('Source token not found');
50
- }
51
- const targetToken = constants_1.tokens[targetChainId].find(t => t.address.toLowerCase() === position.withdraw[0].targetToken.toLowerCase());
52
- if (!targetToken) {
53
- throw Error('Target token not found');
54
- }
55
- if (!sourceToken.aliases.some(alias => targetToken.aliases.includes(alias))) {
56
- throw Error('Source and target token must be the same');
57
- }
58
- const networks = [137, 43114];
59
- const networkUserData = {};
60
- for (const network of networks) {
61
- networkUserData[network] = await getBridgeAmounts(bridger, constants_1.tokens[network].map(t => t.address), network);
62
- }
63
- for (const tokenSymbol of ["dai", "usdc", "usdt", "eth", "wbtc"]) {
64
- let totalDeposit = ethers_1.BigNumber.from(0);
65
- let totalWithdraw = ethers_1.BigNumber.from(0);
66
- for (const network of networks) {
67
- // on avax might we have 2 usdc/usdt tokens
68
- const matchedTokens = constants_1.tokens[network].filter(t => t.aliases.includes(tokenSymbol));
69
- for (const matchedToken of matchedTokens) {
70
- const data = networkUserData[network].find(t => t.token.toLowerCase() === matchedToken.address.toLowerCase());
71
- if (data) {
72
- totalDeposit = totalDeposit.add(data.deposit);
73
- totalWithdraw = totalWithdraw.add(data.withdraw);
74
- }
75
- }
76
- // on Mainent add weth too
77
- if (tokenSymbol === "eth" && network === 1) {
78
- const weth = constants_1.tokens[1].find(t => t.symbol === 'WETH');
79
- if (weth) {
80
- const data = networkUserData[1].find(t => t.token.toLowerCase() === weth.address.toLowerCase());
81
- if (data) {
82
- totalDeposit = totalDeposit.add(data.deposit);
83
- totalWithdraw = totalWithdraw.add(data.withdraw);
84
- }
85
- }
86
- }
87
- }
88
- if (totalWithdraw.gt(totalDeposit)) {
89
- throw Error(`if withdraw > deposit, user has debt and we can't process the withdraw and reject it`);
90
- }
91
- if (totalWithdraw.lt(totalDeposit)) {
92
- throw Error('Something went wrong');
93
- }
94
- }
95
- let balance = ethers_1.BigNumber.from(0);
96
- if (position.withdraw[0].sourceToken.toLowerCase() === '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'.toLowerCase()) {
97
- balance = await sourceChainProvider.getBalance(bridger);
98
- }
99
- else {
100
- const erc20 = (0, utils_1.getContract)(position.withdraw[0].sourceToken, abi_1.default.erc20, sourceChainProvider);
101
- balance = await erc20.balanceOf(constants_1.addresses[sourceChainId].gnosisSafe);
102
- }
103
- if (balance.lt(position.withdraw[0].amount)) {
104
- throw new utils_1.LiquidityError();
105
- }
106
- const { data } = await contract.populateTransaction.withdrawRequested(actionId, bridger, position.withdraw[0].sourceToken, position.withdraw[0].targetToken, position.withdraw[0].amount, targetChainId, transaction.requestTransactionHash, metadata);
107
- transactions.push({
108
- to: contractAddress,
109
- data: data,
110
- value: '0',
111
- operation: ethers_multisend_1.OperationType.Call,
112
- });
18
+ // if (transaction.actionId !== 'withdraw') {
19
+ // throw new Error(`Invalid action: ${transaction.actionId}`)
20
+ // }
21
+ // if (type !== 'source') {
22
+ // throw new Error(`[WIP] Type not supported: ${type}`)
23
+ // }
24
+ // if (transaction.sourceStatus === 'pending') {
25
+ // throw Error('Source transaction already processesing')
26
+ // }
27
+ // if (transaction.sourceStatus === 'pending') {
28
+ // throw Error('Source transaction already processed')
29
+ // }
30
+ // if (!transaction.requestEvent) {
31
+ // throw Error('Something went wrong, source transaction has no request event')
32
+ // }
33
+ // const { actionId, bridger, position, sourceChainId, targetChainId, metadata } = transaction.requestEvent;
34
+ // const sourceChainProvider = new ethers.providers.JsonRpcProvider(getRpcProviderUrl(sourceChainId as ChainId));
35
+ // const sourceWallet = new ethers.Wallet(config.privateKey, sourceChainProvider);
36
+ // const contractAddress = addresses[sourceChainId].interopX;
37
+ // const contract = getContract<InteropX>(contractAddress, abi.interopX, sourceWallet);
38
+ // const sourceToken = tokens[sourceChainId].find(t => t.address.toLowerCase() === position.withdraw[0].sourceToken.toLowerCase());
39
+ // if (!sourceToken) {
40
+ // throw Error('Source token not found')
41
+ // }
42
+ // const targetToken = tokens[targetChainId].find(t => t.address.toLowerCase() === position.withdraw[0].targetToken.toLowerCase());
43
+ // if (!targetToken) {
44
+ // throw Error('Target token not found')
45
+ // }
46
+ // if (!sourceToken.aliases.some(alias => targetToken.aliases.includes(alias))) {
47
+ // throw Error('Source and target token must be the same')
48
+ // }
49
+ // const networks: ChainId[] = [137, 43114];
50
+ // const networkUserData = {}
51
+ // for (const network of networks) {
52
+ // networkUserData[network] = await getBridgeAmounts(bridger, tokens[network].map(t => t.address), network)
53
+ // }
54
+ // for (const tokenSymbol of ["dai", "usdc", "usdt", "eth", "wbtc"]) {
55
+ // let totalDeposit = BigNumber.from(0)
56
+ // let totalWithdraw = BigNumber.from(0)
57
+ // for (const network of networks) {
58
+ // // on avax might we have 2 usdc/usdt tokens
59
+ // const matchedTokens = tokens[network].filter(t => t.aliases.includes(tokenSymbol));
60
+ // for (const matchedToken of matchedTokens) {
61
+ // const data = networkUserData[network].find(t => t.token.toLowerCase() === matchedToken.address.toLowerCase());
62
+ // if (data) {
63
+ // totalDeposit = totalDeposit.add(data.deposit)
64
+ // totalWithdraw = totalWithdraw.add(data.withdraw)
65
+ // }
66
+ // }
67
+ // // on Mainent add weth too
68
+ // if (tokenSymbol === "eth" && network === 1) {
69
+ // const weth = tokens[1].find(t => t.symbol === 'WETH');
70
+ // if (weth) {
71
+ // const data = networkUserData[1].find(t => t.token.toLowerCase() === weth.address.toLowerCase());
72
+ // if (data) {
73
+ // totalDeposit = totalDeposit.add(data.deposit)
74
+ // totalWithdraw = totalWithdraw.add(data.withdraw)
75
+ // }
76
+ // }
77
+ // }
78
+ // }
79
+ // if (totalWithdraw.gt(totalDeposit)) {
80
+ // throw Error(`if withdraw > deposit, user has debt and we can't process the withdraw and reject it`)
81
+ // }
82
+ // if (totalWithdraw.lt(totalDeposit)) {
83
+ // throw Error('Something went wrong')
84
+ // }
85
+ // }
86
+ // let balance = BigNumber.from(0);
87
+ // if (position.withdraw[0].sourceToken.toLowerCase() === '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'.toLowerCase()) {
88
+ // balance = await sourceChainProvider.getBalance(bridger);
89
+ // } else {
90
+ // const erc20 = getContract<Erc20>(position.withdraw[0].sourceToken, abi.erc20, sourceChainProvider);
91
+ // balance = await erc20.balanceOf(addresses[sourceChainId].gnosisSafe);
92
+ // }
93
+ // if (balance.lt(position.withdraw[0].amount)) {
94
+ // throw new LiquidityError()
95
+ // }
96
+ // const { data } = await contract.populateTransaction.withdrawRequested(
97
+ // actionId,
98
+ // bridger,
99
+ // position.withdraw[0].sourceToken,
100
+ // position.withdraw[0].targetToken,
101
+ // position.withdraw[0].amount,
102
+ // targetChainId,
103
+ // transaction.requestTransactionHash,
104
+ // metadata,
105
+ // );
106
+ // transactions.push({
107
+ // to: contractAddress,
108
+ // data: data!,
109
+ // value: '0',
110
+ // operation: OperationType.Call,
111
+ // });
113
112
  return { transactions, logs };
114
113
  }
115
114
  exports.default = default_1;
package/dist/src/index.js CHANGED
@@ -13,7 +13,7 @@ const package_json_1 = __importDefault(require("../package.json"));
13
13
  dotenv_1.default.config();
14
14
  const logger_1 = __importDefault(require("@/logger"));
15
15
  const logger = new logger_1.default('Process');
16
- const GIT_SHORT_HASH = '73e5298';
16
+ const GIT_SHORT_HASH = '7738003';
17
17
  const printUsage = () => {
18
18
  console.log();
19
19
  console.log(`Interop X Node (v${package_json_1.default.version} - rev.${GIT_SHORT_HASH})`);
@@ -11,38 +11,41 @@ const db_1 = require("@/db");
11
11
  const utils_1 = require("@/utils");
12
12
  const constants_1 = require("@/constants");
13
13
  const config_1 = __importDefault(require("@/config"));
14
- class SyncBridgeRequestEvents extends BaseTask_1.BaseTask {
14
+ class SyncLogSubmitEvents extends BaseTask_1.BaseTask {
15
15
  constructor({ chainId }) {
16
16
  super({
17
- logger: new logger_1.default("InteropXContract::SyncBridgeRequestEvents"),
17
+ logger: new logger_1.default("InteropX::SyncLogSubmitEvents"),
18
18
  });
19
19
  this.chainId = chainId;
20
20
  }
21
21
  async pollHandler() {
22
22
  const currentBlock = await this.provider.getBlockNumber();
23
- const events = await this.contract.queryFilter(this.contract.filters.LogBridgeRequest(), currentBlock - 2000, currentBlock);
23
+ const events = await this.contract.queryFilter(this.contract.filters.LogSubmit(), currentBlock - 2000, currentBlock);
24
24
  let processedEvents = 0;
25
25
  for (const event of events) {
26
26
  try {
27
27
  if (!event.args) {
28
28
  continue;
29
29
  }
30
- const { actionId, bridger, position, sourceChainId, targetChainId, metadata } = event.args;
30
+ const { position, actionId, actionIdHashHash, sourceSender, sourceDsaId, targetDsaId, sourceChainId, targetChainId, vnonce, metadata, } = event.args;
31
31
  const uniqueIdentifier = {
32
32
  actionId,
33
- bridger,
34
- requestTransactionHash: event.transactionHash,
33
+ vnonce: vnonce.toString(),
34
+ sourceSender: sourceSender.toString(),
35
35
  sourceChainId: sourceChainId.toNumber(),
36
36
  targetChainId: targetChainId.toNumber(),
37
+ sourceDsaId: sourceDsaId.toString(),
38
+ targetDsaId: targetDsaId.toString(),
37
39
  };
38
40
  let transactionHash = (0, utils_1.generateInteropTransactionHash)(uniqueIdentifier);
39
41
  const transaction = await db_1.Transaction.findOne({ where: { transactionHash } });
40
42
  if (transaction) {
41
43
  continue;
42
44
  }
43
- await db_1.Transaction.create(Object.assign(Object.assign({ transactionHash }, uniqueIdentifier), { requestBlockNumber: event.blockNumber, requestEvent: {
45
+ await db_1.Transaction.create(Object.assign(Object.assign({ transactionHash }, uniqueIdentifier), { submitChainId: this.chainId, submitTransactionHash: event.transactionHash, submitBlockNumber: event.blockNumber, submitCreatedAt: new Date(), submitEvent: {
44
46
  actionId,
45
- bridger,
47
+ actionIdHashHash,
48
+ vnonce: vnonce.toString(),
46
49
  position: {
47
50
  withdraw: position.withdraw.map((v) => ({
48
51
  sourceToken: v.sourceToken,
@@ -57,9 +60,12 @@ class SyncBridgeRequestEvents extends BaseTask_1.BaseTask {
57
60
  },
58
61
  sourceChainId: sourceChainId.toNumber(),
59
62
  targetChainId: targetChainId.toNumber(),
63
+ sourceSender,
64
+ sourceDsaId: sourceDsaId.toString(),
65
+ targetDsaId: targetDsaId.toString(),
60
66
  metadata,
61
67
  } }));
62
- this.logger.info(`New bridge request received: ${transactionHash} `);
68
+ this.logger.info(`New InteropX tranaction: ${transactionHash} `);
63
69
  }
64
70
  catch (error) {
65
71
  this.logger.error(error);
@@ -69,10 +75,10 @@ class SyncBridgeRequestEvents extends BaseTask_1.BaseTask {
69
75
  this.logger.info(`${processedEvents} events processed`);
70
76
  }
71
77
  async start() {
72
- this.contractAddress = constants_1.addresses[this.chainId].interopXContract;
78
+ this.contractAddress = constants_1.addresses[this.chainId].interopX;
73
79
  this.provider = new ethers_1.ethers.providers.JsonRpcProvider((0, utils_1.getRpcProviderUrl)(this.chainId));
74
- this.contract = (0, utils_1.getContract)(this.contractAddress, abi_1.default.interopXContract, new ethers_1.ethers.Wallet(config_1.default.privateKey, this.provider));
80
+ this.contract = (0, utils_1.getContract)(this.contractAddress, abi_1.default.interopX, new ethers_1.ethers.Wallet(config_1.default.privateKey, this.provider));
75
81
  await super.start();
76
82
  }
77
83
  }
78
- exports.default = SyncBridgeRequestEvents;
84
+ exports.default = SyncLogSubmitEvents;
@@ -24,11 +24,11 @@ class SyncTransactionStatusTask extends BaseTask_1.BaseTask {
24
24
  }
25
25
  const transaction = await db_1.Transaction.findOne({
26
26
  where: {
27
- status: {
28
- [sequelize_1.Op.ne]: 'success'
27
+ sourceStatus: {
28
+ [sequelize_1.Op.notIn]: ['success', 'failed'],
29
29
  },
30
30
  sourceCreatedAt: {
31
- [sequelize_1.Op.gte]: new Date(Date.now() - 60 * 60 * 1000),
31
+ [sequelize_1.Op.gte]: new Date(Date.now() - 15 * 60 * 1000),
32
32
  },
33
33
  }
34
34
  });
@@ -6,24 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Tasks = void 0;
7
7
  const waait_1 = __importDefault(require("waait"));
8
8
  const AutoUpdateTask_1 = __importDefault(require("./AutoUpdateTask"));
9
- const SyncBridgeRequestEvents_1 = __importDefault(require("./InteropXContract/SyncBridgeRequestEvents"));
10
- const ProcessBridgeRequestEvents_1 = __importDefault(require("./InteropXContract/ProcessBridgeRequestEvents"));
11
- const SyncBridgeRequestSentEvents_1 = __importDefault(require("./InteropXContract/SyncBridgeRequestSentEvents"));
12
- const SyncBridgeCommittedEvents_1 = __importDefault(require("./InteropXContract/SyncBridgeCommittedEvents"));
9
+ const SyncLogSubmitEvents_1 = __importDefault(require("./InteropX/SyncLogSubmitEvents"));
13
10
  class Tasks {
14
11
  constructor() {
15
12
  this.tasks = [
16
13
  // new SyncTransactionStatusTask(),
17
14
  new AutoUpdateTask_1.default(),
18
- // InteropXContract
19
- new SyncBridgeRequestEvents_1.default({ chainId: 137 }),
20
- new SyncBridgeRequestEvents_1.default({ chainId: 43114 }),
21
- new SyncBridgeRequestSentEvents_1.default({ chainId: 137 }),
22
- new SyncBridgeRequestSentEvents_1.default({ chainId: 43114 }),
23
- new SyncBridgeCommittedEvents_1.default({ chainId: 137 }),
24
- new SyncBridgeCommittedEvents_1.default({ chainId: 43114 }),
25
- new ProcessBridgeRequestEvents_1.default({ chainId: 137 }),
26
- new ProcessBridgeRequestEvents_1.default({ chainId: 43114 }),
15
+ // InteropX
16
+ new SyncLogSubmitEvents_1.default({ chainId: 137 }),
17
+ new SyncLogSubmitEvents_1.default({ chainId: 43114 }),
27
18
  ];
28
19
  }
29
20
  async start() {