@instadapp/interop-x 0.0.0-dev.d2e8d37 → 0.0.0-dev.de23e71
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.
- package/dist/package.json +2 -2
- package/dist/src/abi/interopBridgeToken.json +21 -9
- package/dist/src/abi/interopXGateway.json +11 -11
- package/dist/src/alias.js +10 -0
- package/dist/src/api/index.js +3 -0
- package/dist/src/config/index.js +10 -1
- package/dist/src/constants/addresses.js +1 -1
- package/dist/src/constants/itokens.js +1 -1
- package/dist/src/db/models/transaction.js +8 -0
- package/dist/src/gnosis/actions/deposit.js +48 -0
- package/dist/src/gnosis/actions/index.js +11 -0
- package/dist/src/gnosis/actions/withdraw.js +50 -0
- package/dist/src/gnosis/index.js +20 -0
- package/dist/src/index.js +31 -21
- package/dist/src/net/protocol/dial/SignatureDialProtocol.js +3 -8
- 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/AutoUpdateTask.js +11 -8
- package/dist/src/tasks/BaseTask.js +4 -0
- package/dist/src/tasks/InteropBridge/ProcessWithdrawEvents.js +17 -1
- package/dist/src/tasks/InteropBridge/{SyncWithdrawEvents.js → SyncBurnEvents.js} +10 -8
- package/dist/src/tasks/InteropBridge/SyncMintEvents.js +67 -0
- package/dist/src/tasks/InteropXGateway/ProcessDepositEvents.js +16 -1
- package/dist/src/tasks/InteropXGateway/SyncDepositEvents.js +2 -2
- package/dist/src/tasks/InteropXGateway/SyncWithdrawtEvents.js +72 -0
- package/dist/src/tasks/Transactions/SyncTransactionStatusTask.js +2 -0
- package/dist/src/tasks/index.js +16 -5
- package/dist/src/typechain/factories/InteropBridgeToken__factory.js +23 -11
- package/dist/src/typechain/factories/InteropXGateway__factory.js +14 -14
- package/dist/src/utils/index.js +1 -82
- package/package.json +2 -2
- package/src/abi/interopBridgeToken.json +21 -9
- package/src/abi/interopXGateway.json +11 -11
- package/src/alias.ts +6 -0
- package/src/api/index.ts +3 -0
- package/src/config/index.ts +9 -1
- package/src/constants/addresses.ts +1 -1
- package/src/constants/itokens.ts +1 -1
- package/src/db/models/transaction.ts +10 -0
- package/src/gnosis/actions/deposit.ts +63 -0
- package/src/gnosis/actions/index.ts +7 -0
- package/src/gnosis/actions/withdraw.ts +67 -0
- package/src/gnosis/index.ts +19 -0
- package/src/index.ts +44 -25
- package/src/net/protocol/dial/SignatureDialProtocol.ts +5 -11
- package/src/net/protocol/dial/{SignatureDialProtocol.1.ts → TransactionStatusDialProtocol.ts} +3 -1
- package/src/net/protocol/index.ts +17 -7
- package/src/tasks/AutoUpdateTask.ts +15 -14
- package/src/tasks/BaseTask.ts +5 -0
- package/src/tasks/InteropBridge/ProcessWithdrawEvents.ts +24 -6
- package/src/tasks/InteropBridge/{SyncWithdrawEvents.ts → SyncBurnEvents.ts} +13 -13
- package/src/tasks/InteropBridge/SyncMintEvents.ts +99 -0
- package/src/tasks/InteropXGateway/ProcessDepositEvents.ts +22 -5
- package/src/tasks/InteropXGateway/SyncDepositEvents.ts +2 -2
- package/src/tasks/InteropXGateway/SyncWithdrawtEvents.ts +105 -0
- package/src/tasks/Transactions/SyncTransactionStatusTask.ts +2 -0
- package/src/tasks/index.ts +24 -5
- package/src/typechain/InteropBridgeToken.ts +23 -17
- package/src/typechain/InteropXGateway.ts +13 -13
- package/src/typechain/factories/InteropBridgeToken__factory.ts +23 -11
- package/src/typechain/factories/InteropXGateway__factory.ts +14 -14
- package/src/utils/index.ts +1 -122
- package/tsconfig.json +7 -2
@@ -31,11 +31,11 @@ export interface InteropBridgeTokenInterface extends utils.Interface {
|
|
31
31
|
"allowance(address,address)": FunctionFragment;
|
32
32
|
"approve(address,uint256)": FunctionFragment;
|
33
33
|
"balanceOf(address)": FunctionFragment;
|
34
|
-
"burn(address,uint256,
|
34
|
+
"burn(address,uint256,uint32)": FunctionFragment;
|
35
35
|
"decimals()": FunctionFragment;
|
36
36
|
"decreaseAllowance(address,uint256)": FunctionFragment;
|
37
37
|
"increaseAllowance(address,uint256)": FunctionFragment;
|
38
|
-
"mint(address,uint256,
|
38
|
+
"mint(address,uint256,uint32,bytes32)": FunctionFragment;
|
39
39
|
"name()": FunctionFragment;
|
40
40
|
"owner()": FunctionFragment;
|
41
41
|
"renounceOwnership()": FunctionFragment;
|
@@ -153,8 +153,8 @@ export interface InteropBridgeTokenInterface extends utils.Interface {
|
|
153
153
|
|
154
154
|
events: {
|
155
155
|
"Approval(address,address,uint256)": EventFragment;
|
156
|
-
"Burn(address,uint256,
|
157
|
-
"Mint(address,uint256,
|
156
|
+
"Burn(address,uint256,uint32,uint32)": EventFragment;
|
157
|
+
"Mint(address,uint256,uint32,uint32,bytes32)": EventFragment;
|
158
158
|
"OwnershipTransferred(address,address)": EventFragment;
|
159
159
|
"Transfer(address,address,uint256)": EventFragment;
|
160
160
|
};
|
@@ -181,10 +181,11 @@ export type ApprovalEventFilter = TypedEventFilter<ApprovalEvent>;
|
|
181
181
|
export interface BurnEventObject {
|
182
182
|
to: string;
|
183
183
|
amount: BigNumber;
|
184
|
-
|
184
|
+
sourceChainId: number;
|
185
|
+
targetChainId: number;
|
185
186
|
}
|
186
187
|
export type BurnEvent = TypedEvent<
|
187
|
-
[string, BigNumber,
|
188
|
+
[string, BigNumber, number, number],
|
188
189
|
BurnEventObject
|
189
190
|
>;
|
190
191
|
|
@@ -193,11 +194,12 @@ export type BurnEventFilter = TypedEventFilter<BurnEvent>;
|
|
193
194
|
export interface MintEventObject {
|
194
195
|
to: string;
|
195
196
|
amount: BigNumber;
|
196
|
-
|
197
|
-
|
197
|
+
sourceChainId: number;
|
198
|
+
targetChainId: number;
|
199
|
+
submitTransactionHash: string;
|
198
200
|
}
|
199
201
|
export type MintEvent = TypedEvent<
|
200
|
-
[string, BigNumber,
|
202
|
+
[string, BigNumber, number, number, string],
|
201
203
|
MintEventObject
|
202
204
|
>;
|
203
205
|
|
@@ -486,28 +488,32 @@ export interface InteropBridgeToken extends BaseContract {
|
|
486
488
|
value?: null
|
487
489
|
): ApprovalEventFilter;
|
488
490
|
|
489
|
-
"Burn(address,uint256,
|
491
|
+
"Burn(address,uint256,uint32,uint32)"(
|
490
492
|
to?: string | null,
|
491
493
|
amount?: null,
|
492
|
-
|
494
|
+
sourceChainId?: null,
|
495
|
+
targetChainId?: BigNumberish | null
|
493
496
|
): BurnEventFilter;
|
494
497
|
Burn(
|
495
498
|
to?: string | null,
|
496
499
|
amount?: null,
|
497
|
-
|
500
|
+
sourceChainId?: null,
|
501
|
+
targetChainId?: BigNumberish | null
|
498
502
|
): BurnEventFilter;
|
499
503
|
|
500
|
-
"Mint(address,uint256,
|
504
|
+
"Mint(address,uint256,uint32,uint32,bytes32)"(
|
501
505
|
to?: string | null,
|
502
506
|
amount?: null,
|
503
|
-
|
504
|
-
|
507
|
+
sourceChainId?: BigNumberish | null,
|
508
|
+
targetChainId?: null,
|
509
|
+
submitTransactionHash?: BytesLike | null
|
505
510
|
): MintEventFilter;
|
506
511
|
Mint(
|
507
512
|
to?: string | null,
|
508
513
|
amount?: null,
|
509
|
-
|
510
|
-
|
514
|
+
sourceChainId?: BigNumberish | null,
|
515
|
+
targetChainId?: null,
|
516
|
+
submitTransactionHash?: BytesLike | null
|
511
517
|
): MintEventFilter;
|
512
518
|
|
513
519
|
"OwnershipTransferred(address,address)"(
|
@@ -29,11 +29,11 @@ import type {
|
|
29
29
|
export interface InteropXGatewayInterface extends utils.Interface {
|
30
30
|
functions: {
|
31
31
|
"_vnonce()": FunctionFragment;
|
32
|
-
"deposit(address,uint256,
|
33
|
-
"depositFor(address,address,uint256,
|
32
|
+
"deposit(address,uint256,uint32)": FunctionFragment;
|
33
|
+
"depositFor(address,address,uint256,uint32)": FunctionFragment;
|
34
34
|
"owner()": FunctionFragment;
|
35
35
|
"renounceOwnership()": FunctionFragment;
|
36
|
-
"systemWithdraw(uint256,address,address,
|
36
|
+
"systemWithdraw(uint256,address,address,uint32,bytes32)": FunctionFragment;
|
37
37
|
"transferOwnership(address)": FunctionFragment;
|
38
38
|
};
|
39
39
|
|
@@ -89,8 +89,8 @@ export interface InteropXGatewayInterface extends utils.Interface {
|
|
89
89
|
): Result;
|
90
90
|
|
91
91
|
events: {
|
92
|
-
"LogGatewayDeposit(address,address,uint256,uint256,
|
93
|
-
"LogGatewayWithdraw(address,address,uint256,
|
92
|
+
"LogGatewayDeposit(address,address,uint256,uint256,uint32,uint32)": EventFragment;
|
93
|
+
"LogGatewayWithdraw(address,address,uint256,uint32,uint32,bytes32)": EventFragment;
|
94
94
|
"OwnershipTransferred(address,address)": EventFragment;
|
95
95
|
};
|
96
96
|
|
@@ -104,11 +104,11 @@ export interface LogGatewayDepositEventObject {
|
|
104
104
|
token: string;
|
105
105
|
amount: BigNumber;
|
106
106
|
vnonce: BigNumber;
|
107
|
-
sourceChainId:
|
108
|
-
targetChainId:
|
107
|
+
sourceChainId: number;
|
108
|
+
targetChainId: number;
|
109
109
|
}
|
110
110
|
export type LogGatewayDepositEvent = TypedEvent<
|
111
|
-
[string, string, BigNumber, BigNumber,
|
111
|
+
[string, string, BigNumber, BigNumber, number, number],
|
112
112
|
LogGatewayDepositEventObject
|
113
113
|
>;
|
114
114
|
|
@@ -119,12 +119,12 @@ export interface LogGatewayWithdrawEventObject {
|
|
119
119
|
user: string;
|
120
120
|
token: string;
|
121
121
|
amount: BigNumber;
|
122
|
-
sourceChainId:
|
123
|
-
targetChainId:
|
122
|
+
sourceChainId: number;
|
123
|
+
targetChainId: number;
|
124
124
|
transactionHash: string;
|
125
125
|
}
|
126
126
|
export type LogGatewayWithdrawEvent = TypedEvent<
|
127
|
-
[string, string, BigNumber,
|
127
|
+
[string, string, BigNumber, number, number, string],
|
128
128
|
LogGatewayWithdrawEventObject
|
129
129
|
>;
|
130
130
|
|
@@ -283,7 +283,7 @@ export interface InteropXGateway extends BaseContract {
|
|
283
283
|
};
|
284
284
|
|
285
285
|
filters: {
|
286
|
-
"LogGatewayDeposit(address,address,uint256,uint256,
|
286
|
+
"LogGatewayDeposit(address,address,uint256,uint256,uint32,uint32)"(
|
287
287
|
user?: null,
|
288
288
|
token?: string | null,
|
289
289
|
amount?: null,
|
@@ -300,7 +300,7 @@ export interface InteropXGateway extends BaseContract {
|
|
300
300
|
targetChainId?: BigNumberish | null
|
301
301
|
): LogGatewayDepositEventFilter;
|
302
302
|
|
303
|
-
"LogGatewayWithdraw(address,address,uint256,
|
303
|
+
"LogGatewayWithdraw(address,address,uint256,uint32,uint32,bytes32)"(
|
304
304
|
user?: null,
|
305
305
|
token?: string | null,
|
306
306
|
amount?: null,
|
@@ -61,11 +61,17 @@ const _abi = [
|
|
61
61
|
name: "amount",
|
62
62
|
type: "uint256",
|
63
63
|
},
|
64
|
+
{
|
65
|
+
indexed: false,
|
66
|
+
internalType: "uint32",
|
67
|
+
name: "sourceChainId",
|
68
|
+
type: "uint32",
|
69
|
+
},
|
64
70
|
{
|
65
71
|
indexed: true,
|
66
|
-
internalType: "
|
67
|
-
name: "
|
68
|
-
type: "
|
72
|
+
internalType: "uint32",
|
73
|
+
name: "targetChainId",
|
74
|
+
type: "uint32",
|
69
75
|
},
|
70
76
|
],
|
71
77
|
name: "Burn",
|
@@ -88,14 +94,20 @@ const _abi = [
|
|
88
94
|
},
|
89
95
|
{
|
90
96
|
indexed: true,
|
91
|
-
internalType: "
|
92
|
-
name: "
|
93
|
-
type: "
|
97
|
+
internalType: "uint32",
|
98
|
+
name: "sourceChainId",
|
99
|
+
type: "uint32",
|
100
|
+
},
|
101
|
+
{
|
102
|
+
indexed: false,
|
103
|
+
internalType: "uint32",
|
104
|
+
name: "targetChainId",
|
105
|
+
type: "uint32",
|
94
106
|
},
|
95
107
|
{
|
96
108
|
indexed: true,
|
97
109
|
internalType: "bytes32",
|
98
|
-
name: "
|
110
|
+
name: "submitTransactionHash",
|
99
111
|
type: "bytes32",
|
100
112
|
},
|
101
113
|
],
|
@@ -226,9 +238,9 @@ const _abi = [
|
|
226
238
|
type: "uint256",
|
227
239
|
},
|
228
240
|
{
|
229
|
-
internalType: "
|
241
|
+
internalType: "uint32",
|
230
242
|
name: "chainId",
|
231
|
-
type: "
|
243
|
+
type: "uint32",
|
232
244
|
},
|
233
245
|
],
|
234
246
|
name: "burn",
|
@@ -310,9 +322,9 @@ const _abi = [
|
|
310
322
|
type: "uint256",
|
311
323
|
},
|
312
324
|
{
|
313
|
-
internalType: "
|
325
|
+
internalType: "uint32",
|
314
326
|
name: "chainId",
|
315
|
-
type: "
|
327
|
+
type: "uint32",
|
316
328
|
},
|
317
329
|
{
|
318
330
|
internalType: "bytes32",
|
@@ -50,15 +50,15 @@ const _abi = [
|
|
50
50
|
},
|
51
51
|
{
|
52
52
|
indexed: false,
|
53
|
-
internalType: "
|
53
|
+
internalType: "uint32",
|
54
54
|
name: "sourceChainId",
|
55
|
-
type: "
|
55
|
+
type: "uint32",
|
56
56
|
},
|
57
57
|
{
|
58
58
|
indexed: true,
|
59
|
-
internalType: "
|
59
|
+
internalType: "uint32",
|
60
60
|
name: "targetChainId",
|
61
|
-
type: "
|
61
|
+
type: "uint32",
|
62
62
|
},
|
63
63
|
],
|
64
64
|
name: "LogGatewayDeposit",
|
@@ -87,15 +87,15 @@ const _abi = [
|
|
87
87
|
},
|
88
88
|
{
|
89
89
|
indexed: true,
|
90
|
-
internalType: "
|
90
|
+
internalType: "uint32",
|
91
91
|
name: "sourceChainId",
|
92
|
-
type: "
|
92
|
+
type: "uint32",
|
93
93
|
},
|
94
94
|
{
|
95
95
|
indexed: false,
|
96
|
-
internalType: "
|
96
|
+
internalType: "uint32",
|
97
97
|
name: "targetChainId",
|
98
|
-
type: "
|
98
|
+
type: "uint32",
|
99
99
|
},
|
100
100
|
{
|
101
101
|
indexed: true,
|
@@ -152,9 +152,9 @@ const _abi = [
|
|
152
152
|
type: "uint256",
|
153
153
|
},
|
154
154
|
{
|
155
|
-
internalType: "
|
155
|
+
internalType: "uint32",
|
156
156
|
name: "chainId_",
|
157
|
-
type: "
|
157
|
+
type: "uint32",
|
158
158
|
},
|
159
159
|
],
|
160
160
|
name: "deposit",
|
@@ -180,9 +180,9 @@ const _abi = [
|
|
180
180
|
type: "uint256",
|
181
181
|
},
|
182
182
|
{
|
183
|
-
internalType: "
|
183
|
+
internalType: "uint32",
|
184
184
|
name: "chainId_",
|
185
|
-
type: "
|
185
|
+
type: "uint32",
|
186
186
|
},
|
187
187
|
],
|
188
188
|
name: "depositFor",
|
@@ -228,9 +228,9 @@ const _abi = [
|
|
228
228
|
type: "address",
|
229
229
|
},
|
230
230
|
{
|
231
|
-
internalType: "
|
231
|
+
internalType: "uint32",
|
232
232
|
name: "chainId_",
|
233
|
-
type: "
|
233
|
+
type: "uint32",
|
234
234
|
},
|
235
235
|
{
|
236
236
|
internalType: "bytes32",
|
package/src/utils/index.ts
CHANGED
@@ -3,15 +3,9 @@
|
|
3
3
|
*/
|
4
4
|
import axios from 'axios'
|
5
5
|
import axiosRetry from "axios-retry";
|
6
|
-
import { addresses
|
6
|
+
import { addresses } from '@/constants';
|
7
7
|
import { ChainId } from '@/types'
|
8
8
|
import { ethers } from 'ethers';
|
9
|
-
import { encodeMulti, MetaTransaction, OperationType } from 'ethers-multisend';
|
10
|
-
import { Transaction } from '@/db';
|
11
|
-
import config from '@/config';
|
12
|
-
import abi from '@/abi';
|
13
|
-
import { InteropBridgeToken, InteropXGateway } from '@/typechain';
|
14
|
-
|
15
9
|
export const http = axios.create();
|
16
10
|
|
17
11
|
axiosRetry(http, { retries: 3, retryDelay: axiosRetry.exponentialDelay });
|
@@ -145,121 +139,6 @@ export const generateInteropTransactionHash = (data: { action: string, submitTra
|
|
145
139
|
]);
|
146
140
|
}
|
147
141
|
|
148
|
-
export const buildDataForTransaction = async (transaction: Transaction, type?: 'source' | 'target') => {
|
149
|
-
type = type || transaction.sourceStatus === 'pending' ? 'source' : 'target';
|
150
|
-
|
151
|
-
switch (transaction.action) {
|
152
|
-
case "deposit":
|
153
|
-
return await buildDepositDataForTransaction(transaction, type);
|
154
|
-
case "withdraw":
|
155
|
-
return await buildWithdrawDataForTransaction(transaction, type);
|
156
|
-
default:
|
157
|
-
throw new Error(`Unknown action: ${transaction.action}`);
|
158
|
-
}
|
159
|
-
}
|
160
|
-
|
161
|
-
export const buildDepositDataForTransaction = async (transaction: Transaction, type: 'source' | 'target') => {
|
162
|
-
const transactions: MetaTransaction[] = [];
|
163
|
-
|
164
|
-
if (transaction.action !== 'deposit') {
|
165
|
-
throw new Error(`Invalid action: ${transaction.action}`)
|
166
|
-
}
|
167
|
-
|
168
|
-
if (transaction.action === 'deposit' && transaction.sourceStatus === 'pending') {
|
169
|
-
throw Error('Cannot build data for pending deposit transaction');
|
170
|
-
}
|
171
|
-
|
172
|
-
if (!transaction.submitEvent) {
|
173
|
-
throw Error('Cannot build data for transaction without submitEvent');
|
174
|
-
}
|
175
|
-
|
176
|
-
|
177
|
-
const token = tokens[transaction.sourceChainId].find(token => token.address.toLowerCase() === transaction.submitEvent.token.toLowerCase());
|
178
|
-
|
179
|
-
if (!token) {
|
180
|
-
throw Error('Cannot build data for transaction without token');
|
181
|
-
}
|
182
|
-
|
183
|
-
const itoken = itokens[transaction.targetChainId].find(itoken => itoken.symbol.toLowerCase() === token.symbol.toLowerCase());
|
184
|
-
|
185
|
-
if (!itoken) {
|
186
|
-
throw Error('Cannot build data for transaction without itoken');
|
187
|
-
}
|
188
|
-
|
189
|
-
const targetChainProvider = new ethers.providers.JsonRpcProvider(getRpcProviderUrl(transaction.targetChainId as ChainId));
|
190
|
-
const targetWallet = new ethers.Wallet(config.privateKey, targetChainProvider);
|
191
|
-
const interopBridgeContract = getContract<InteropBridgeToken>(itoken.address, abi.interopBridgeToken, targetWallet);
|
192
|
-
|
193
|
-
const { data } = await interopBridgeContract.populateTransaction.mint(
|
194
|
-
transaction.submitEvent.user,
|
195
|
-
ethers.BigNumber.from(transaction.submitEvent.amount.toString()),
|
196
|
-
ethers.BigNumber.from(transaction.submitEvent.sourceChainId.toString()),
|
197
|
-
transaction.submitTransactionHash,
|
198
|
-
);
|
199
|
-
|
200
|
-
transactions.push({
|
201
|
-
to: itoken.address,
|
202
|
-
data: data!,
|
203
|
-
value: '0',
|
204
|
-
operation: OperationType.Call,
|
205
|
-
});
|
206
|
-
|
207
|
-
return encodeMulti(transactions).data
|
208
|
-
}
|
209
|
-
|
210
|
-
export const buildWithdrawDataForTransaction = async (transaction: Transaction, type: 'source' | 'target') => {
|
211
|
-
const transactions: MetaTransaction[] = [];
|
212
|
-
|
213
|
-
if (transaction.action !== 'withdraw') {
|
214
|
-
throw new Error(`Invalid action: ${transaction.action}`)
|
215
|
-
}
|
216
|
-
|
217
|
-
if (transaction.action === 'withdraw' && transaction.sourceStatus === 'pending') {
|
218
|
-
throw Error('Cannot build data for pending withdraw transaction');
|
219
|
-
}
|
220
|
-
|
221
|
-
if (!transaction.submitEvent) {
|
222
|
-
throw Error('Cannot build data for transaction without submitEvent');
|
223
|
-
}
|
224
|
-
|
225
|
-
const { to, amount, chainId, itoken: itokenAddress } = transaction.submitEvent;
|
226
|
-
|
227
|
-
const itoken = itokens[transaction.sourceChainId].find(token => token.address.toLowerCase() === itokenAddress.toLowerCase());
|
228
|
-
|
229
|
-
if (!itoken) {
|
230
|
-
throw Error('Cannot build data for transaction without itoken');
|
231
|
-
}
|
232
|
-
|
233
|
-
const token = tokens[chainId].find(t => t.symbol.toLowerCase() === itoken.symbol.toLowerCase());
|
234
|
-
|
235
|
-
if (!token) {
|
236
|
-
throw Error('Cannot build data for transaction without token');
|
237
|
-
}
|
238
|
-
|
239
|
-
const targetChainProvider = new ethers.providers.JsonRpcProvider(getRpcProviderUrl(transaction.targetChainId as ChainId));
|
240
|
-
const targetWallet = new ethers.Wallet(config.privateKey, targetChainProvider);
|
241
|
-
const gatewayAddress = addresses[chainId].interopXGateway;
|
242
|
-
const interopBridgeContract = getContract<InteropXGateway>(gatewayAddress, abi.interopXGateway, targetWallet);
|
243
|
-
|
244
|
-
const { data } = await interopBridgeContract.populateTransaction.systemWithdraw(
|
245
|
-
ethers.BigNumber.from(amount.toString()),
|
246
|
-
to,
|
247
|
-
token.address,
|
248
|
-
ethers.BigNumber.from(transaction.sourceChainId.toString()),
|
249
|
-
transaction.submitTransactionHash,
|
250
|
-
);
|
251
|
-
|
252
|
-
transactions.push({
|
253
|
-
to: gatewayAddress,
|
254
|
-
data: data!,
|
255
|
-
value: '0',
|
256
|
-
operation: OperationType.Call,
|
257
|
-
});
|
258
|
-
|
259
|
-
return encodeMulti(transactions).data
|
260
|
-
}
|
261
|
-
|
262
|
-
|
263
142
|
export function getContract<TContract extends ethers.Contract>(address: string, contractInterface: ethers.ContractInterface | any, signerOrProvider?: ethers.Signer | ethers.providers.Provider) {
|
264
143
|
if (!ethers.utils.getAddress(address) || address === ethers.constants.AddressZero) {
|
265
144
|
throw Error(`Invalid 'address' parameter '${address}'.`)
|