erc20Bridger
Classes
AdminErc20Bridger
Defined in: assetBridger/erc20Bridger.ts:977
Admin functionality for the token bridge
Extends
Constructors
Constructor
new AdminErc20Bridger(childNetwork: ArbitrumNetwork): AdminErc20Bridger;
Defined in: assetBridger/erc20Bridger.ts:205
Bridger for moving ERC20 tokens back and forth between parent-to-child
Parameters
| Parameter | Type |
|---|---|
childNetwork | ArbitrumNetwork |
Returns
Inherited from
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
nativeToken? | readonly | string | In case of a chain that uses ETH as its native/gas token, this is either undefined or the zero address In case of a chain that uses an ERC-20 token from the parent network as its native/gas token, this is the address of said token on the parent network | Erc20Bridger.nativeToken | assetBridger/assetBridger.ts:40 |
Accessors
nativeTokenIsEth
Get Signature
get protected nativeTokenIsEth(): boolean;
Defined in: assetBridger/assetBridger.ts:72
Whether the chain uses ETH as its native/gas token
Returns
boolean
Inherited from
Methods
approveGasToken()
approveGasToken(params: ApproveParamsOrTxRequest): Promise<ContractTransaction>;
Defined in: assetBridger/erc20Bridger.ts:276
Approves the custom gas token to be spent by the relevant gateway on the parent network
Parameters
| Parameter | Type | Description |
|---|---|---|
params | ApproveParamsOrTxRequest |
Returns
Promise<ContractTransaction>
Inherited from
approveToken()
approveToken(params: ApproveParamsOrTxRequest): Promise<ContractTransaction>;
Defined in: assetBridger/erc20Bridger.ts:339
Approve tokens for deposit to the bridge. The tokens will be approved for the relevant gateway.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | ApproveParamsOrTxRequest |
Returns
Promise<ContractTransaction>
Inherited from
checkChildNetwork()
protected checkChildNetwork(sop: SignerOrProvider): Promise<void>;
Defined in: assetBridger/assetBridger.ts:61
Check the signer/provider matches the child network, throws if not
Parameters
| Parameter | Type | Description |
|---|---|---|
sop | SignerOrProvider |
Returns
Promise<void>
Inherited from
Erc20Bridger.checkChildNetwork
checkParentNetwork()
protected checkParentNetwork(sop: SignerOrProvider): Promise<void>;
Defined in: assetBridger/assetBridger.ts:50
Check the signer/provider matches the parent network, throws if not
Parameters
| Parameter | Type | Description |
|---|---|---|
sop | SignerOrProvider |
Returns
Promise<void>
Inherited from
Erc20Bridger.checkParentNetwork
deposit()
deposit(params: Erc20DepositParams | ParentToChildTxReqAndSignerProvider): Promise<ParentContractCallTransaction>;
Defined in: assetBridger/erc20Bridger.ts:769
Execute a token deposit from parent to child network
Parameters
| Parameter | Type | Description |
|---|---|---|
params | Erc20DepositParams | ParentToChildTxReqAndSignerProvider |
Returns
Promise<ParentContractCallTransaction>
Inherited from
getApproveGasTokenRequest()
getApproveGasTokenRequest(params: ProviderTokenApproveParams): Promise<Required<Pick<TransactionRequest, "to" | "value" | "data">>>;
Defined in: assetBridger/erc20Bridger.ts:260
Creates a transaction request for approving the custom gas token to be spent by the relevant gateway on the parent network
Parameters
| Parameter | Type | Description |
|---|---|---|
params | ProviderTokenApproveParams |
Returns
Promise<Required<Pick<TransactionRequest, "to" | "value" | "data">>>
Inherited from
Erc20Bridger.getApproveGasTokenRequest
getApproveTokenRequest()
getApproveTokenRequest(params: ProviderTokenApproveParams): Promise<Required<Pick<TransactionRequest, "to" | "value" | "data">>>;
Defined in: assetBridger/erc20Bridger.ts:306
Get a tx request to approve tokens for deposit to the bridge. The tokens will be approved for the relevant gateway.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | ProviderTokenApproveParams |
Returns
Promise<Required<Pick<TransactionRequest, "to" | "value" | "data">>>
Inherited from
Erc20Bridger.getApproveTokenRequest
getChildErc20Address()
getChildErc20Address(erc20ParentAddress: string, parentProvider: Provider): Promise<string>;
Defined in: assetBridger/erc20Bridger.ts:491
Get the corresponding child network token address for the provided parent network token
Parameters
| Parameter | Type | Description |
|---|---|---|
erc20ParentAddress | string | |
parentProvider | Provider |
Returns
Promise<string>
Inherited from
Erc20Bridger.getChildErc20Address
getChildGatewayAddress()
getChildGatewayAddress(erc20ParentAddress: string, childProvider: Provider): Promise<string>;
Defined in: assetBridger/erc20Bridger.ts:244
Get the address of the child gateway for this token
Parameters
| Parameter | Type | Description |
|---|---|---|
erc20ParentAddress | string | |
childProvider | Provider |
Returns
Promise<string>
Inherited from
Erc20Bridger.getChildGatewayAddress
getChildGatewaySetEvents()
getChildGatewaySetEvents(
childProvider: Provider,
filter: object,
customNetworkChildGatewayRouter?: string): Promise<object[]>;
Defined in: assetBridger/erc20Bridger.ts:1233
Get all the gateway set events on the child gateway router
Parameters
| Parameter | Type | Description |
|---|---|---|
childProvider | Provider | The provider for the child network |
filter | { fromBlock: BlockTag; toBlock: BlockTag; } | An object containing fromBlock and toBlock to filter events |
filter.fromBlock | BlockTag | - |
filter.toBlock? | BlockTag | - |
customNetworkChildGatewayRouter? | string | Optional address of the custom network child gateway router |
Returns
Promise<object[]>
An array of GatewaySetEvent event arguments
Throws
If the network is custom and customNetworkChildGatewayRouter is not provided
getChildTokenContract()
getChildTokenContract(childProvider: Provider, childTokenAddr: string): L2GatewayToken;
Defined in: assetBridger/erc20Bridger.ts:462
Get the child network token contract at the provided address Note: This function just returns a typed ethers object for the provided address, it doesn't check the underlying form of the contract bytecode to see if it's an erc20, and doesn't ensure the validity of any of the underlying functions on that contract.
Parameters
| Parameter | Type | Description |
|---|---|---|
childProvider | Provider | |
childTokenAddr | string |
Returns
L2GatewayToken
Inherited from
Erc20Bridger.getChildTokenContract
getDepositRequest()
getDepositRequest(params: DepositRequest): Promise<ParentToChildTransactionRequest>;
Defined in: assetBridger/erc20Bridger.ts:655
Get the arguments for calling the deposit function
Parameters
| Parameter | Type | Description |
|---|---|---|
params | DepositRequest |
Returns
Promise<ParentToChildTransactionRequest>