@instadapp/interop-x 0.0.0-dev.8a917f1 → 0.0.0-dev.8d83ec0

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