1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import { Overrides, Contract } from 'ethers'
import {
TransactionRequest,
TransactionResponse,
} from '@ethersproject/abstract-provider'
import { NumberLike, L1ToL2Overrides } from './types'
import { ICrossChainMessenger } from './cross-chain-messenger'
/**
* Represents an L1<>L2 ERC20 token pair.
*/
export interface ICrossChainERC20Pair {
/**
* Messenger that will be used to carry out cross-chain iteractions.
*/
messenger: ICrossChainMessenger
/**
* Ethers Contract object connected to the L1 token.
*/
l1Token: Contract
/**
* Ethers Contract object connected to the L2 token.
*/
l2Token: Contract
/**
* Deposits some tokens into the L2 chain.
*
* @param amount Amount of the token to deposit.
* @param overrides Optional transaction overrides.
* @returns Transaction response for the deposit transaction.
*/
deposit(
amount: NumberLike,
overrides?: L1ToL2Overrides
): Promise<TransactionResponse>
/**
* Withdraws some tokens back to the L1 chain.
*
* @param amount Amount of the token to withdraw.
* @param overrides Optional transaction overrides.
* @returns Transaction response for the withdraw transaction.
*/
withdraw(
amount: NumberLike,
overrides?: Overrides
): Promise<TransactionResponse>
/**
* Object that holds the functions that generate transactions to be signed by the user.
* Follows the pattern used by ethers.js.
*/
populateTransaction: {
/**
* Generates a transaction for depositing some tokens into the L2 chain.
*
* @param amount Amount of the token to deposit.
* @param overrides Optional transaction overrides.
* @returns Transaction that can be signed and executed to deposit the tokens.
*/
deposit(
amount: NumberLike,
overrides?: L1ToL2Overrides
): Promise<TransactionResponse>
/**
* Generates a transaction for withdrawing some tokens back to the L1 chain.
*
* @param amount Amount of the token to withdraw.
* @param overrides Optional transaction overrides.
* @returns Transaction that can be signed and executed to withdraw the tokens.
*/
withdraw(
amount: NumberLike,
overrides?: Overrides
): Promise<TransactionRequest>
}
/**
* Object that holds the functions that estimates the gas required for a given transaction.
* Follows the pattern used by ethers.js.
*/
estimateGas: {
/**
* Estimates gas required to deposit some tokens into the L2 chain.
*
* @param amount Amount of the token to deposit.
* @param overrides Optional transaction overrides.
* @returns Transaction that can be signed and executed to deposit the tokens.
*/
deposit(
amount: NumberLike,
overrides?: L1ToL2Overrides
): Promise<TransactionResponse>
/**
* Estimates gas required to withdraw some tokens back to the L1 chain.
*
* @param amount Amount of the token to withdraw.
* @param overrides Optional transaction overrides.
* @returns Transaction that can be signed and executed to withdraw the tokens.
*/
withdraw(
amount: NumberLike,
overrides?: Overrides
): Promise<TransactionRequest>
}
}