Open liaoyinglong opened 6 months ago
For depositing ETH, you should use EthBridger
. Erc20Bridger
is used for depositing ERC-20 tokens.
yes, I mean when I deposit ERC20 token
that will send some ETH
to bridge in this line
https://github.com/OffchainLabs/arbitrum-sdk/blob/01af6ef017e164bb7cb7febf7026ce60af76a112/src/lib/assetBridger/erc20Bridger.ts#L696
and can I know how much eth
amount will be sent to my L2 address ?
The ETH sent is there to cover for the retryable execution fees and it's necessary for your ERC-20 deposit to succeed.
You can calculate this amount upfront by using the L1ToL2MessageGasEstimator
. You can see here how the Erc20Bridger
uses it: https://github.com/OffchainLabs/arbitrum-sdk/blob/main/src/lib/assetBridger/erc20Bridger.ts#L686
thank you!
The amount is send to bridge's ETH
amount, can i get the amount of will received in L2
address?
example:
ERC20
token to L2
ETH
is 0.00004740420016352 ETH
in L1
ETH
is 0.0000395035 Ether
in L2
from the Smart ContractI'd like to know if it's possible to calculate this value 0.0000395035 Ether
before making a deposit.
First of all, this is an awesome library!
I have a question about when I call
Erc20Bridger.deposit
I can control the amount ofETH
to send? if not, how can I know I will send theETH
amount inL1
and will receive theETH
amount inL2
before do deposit action?the code like:
Thank of all!