vETH
On this page, you can find the contracts and their interactions involved when bridging to and from Ethereum (L1 - $ETH) and Cronos zkEVM (L2 - $vETH ), it includes:
[L1 -> L2] Minting $vETH with $ETH
[L2 -> L1] Withdrawing $ETH from $vETH
[L1 -> L2] Minting $vETH with $ETH
From Ethereum mainnet (L1) to Cronos zkEVM mainnet (L2)
For bridging $ETH (Ethereum Mainnet) to $vETH (Cronos zkEVM Mainnet), we would need to:
Mint and bridge $ybETH from Ethereum to Cronos zkEVM Mainnet with $ETH;
Mint $vETH with $ybETH on Cronos zkEVM Mainnet.
To bridge $ETH from Ethereum mainnet -> Cronos zkEVM mainnet
, and obtain $vETH, we would need to interact with:
ybETHBridge
$ybETH token contract
Cronos zkEVM:
0xf226a595b83056ff3D26b827e3d5b0896E4392a9
$vETH token contract
Cronos zkEVM:
0x271602A97027ee1dd03b1E6e5dB153eB659A80b1
Step 1) Calculating the amount of $ybETH to Bridge
On Ethereum, use ybETH contract to call the convertToShare
function:
Parameters | Comments |
---|---|
| The amount of $ETH (with 18 decimals) to be used to mint $ybETH. |
Keep this amount for later steps.
Step 2) Minting And Bridging $ybETH
On Ethereum, call the mintAndBridge
function on the ybETHBridge contract:
Parameters | Comments |
---|---|
| The address on Cronos zkEVM that will receive $ybETH |
| The amount of $ETH to mint and bridge $ybETH, as calculate in Step 1 |
| Maximum amount of L2 gas that transaction can consume during execution on L2. Reference value: |
| The maximum amount of L2 gas that the operator may charge the user for a single byte of pubdata. Reference value: |
| Address to collect refund, if bridging is unsuccessful. |
This will mint $ybETH on Ethereum and bridge it to the _l2Receiver
address.
Step 3) Approving $ybETH to be spend by $vETH contract
On Cronos zkEVM, call approve
on the $ybETH contract to approve $vETH to spend $ybETH with appropriate amount.
Step 4) Minting of $vETH
On Cronos zkEVM, call mint
on $vETH contract , to mint $vETH
Parameters | Comments |
---|---|
| Address to receive the minted $vETH tokens |
| Amount of $ybETH to be used to mint $vETH |
This will mint $vETH into the _receiver
address.
[L2 -> L1] Withdrawing $ETH from $vETH
From Cronos zkEVM mainnet (L2) -> Ethereum mainnet (L1)
For withdrawing $vETH (Cronos zkEVM Mainnet) and get $ETH (Ethereum Mainnet) , we would need to:
[On Cronos zkEVM] Use $vETH to redeem $ybETH;
[On Cronos zkEVM] Bridge $ybETH to Ethereum;
[On Ethereum] Obtain
vnoNFT
by burning $ybETH[On Ethereum] Withdraw $ETH by buring
vnoNFT
.
To redeem $vETH from Cronos zkEVM mainnet
, and withdraw $ETH on Ethereum mainnet
we would need to interact with the following contracts:
vETH
Cronos zkEVM:
0x271602A97027ee1dd03b1E6e5dB153eB659A80b1
l2Bridge
Cronos zkEVM: 0x309429DE3621992Cb0ab8982A448c9Cc5c38405b
zk Chain Shared Bridge
ybETH
Cronos zkEVM:
0xf226a595b83056ff3D26b827e3d5b0896E4392a9
vnoNFT
Step 1) Approving $vETH to be spend by vETH contract
On Cronos zkEVM, call approve
on the $vETH contract to approve $vETH spend with appropriate amount.
Step 2) Redeeming $vETH for $ybETH
On Cronos zkEVM, call redeem
on the vETH contract, to burn $vETH and redeem $ybETH
Parameters | Comments |
---|---|
| Address to receive $ybETH on Cronos zkEVM |
| Amount of vETH that will be burned to redeem ybETH |
Once done, corresponding $ybETH will be transfer to the _reciever
address
Step 3) Approving $ybETH to be spend by the L2Bridge
On Cronos zkEVM, call approve
on the ybETH contract, to approve L2Bridge
to spend $ybETH.
Step 4) Withdrawing $ybETH and store withdrawal hash
On Cronos zkEVM, call withdraw on the L2Bridge contract
Parameters | Comments |
---|---|
| Address on Ethereum to receive the token |
| The token to be withdrawn, the Cronos zkEVM contract address $ybETH in this case. |
| amount of tokens to be withdrawn, note $ybETH has |
Keep the transaction hash for later use in Step 5. This withdraws $ybETH from Cronos zkEVM to Ethereum. It takes at least 24 hours before the withdrawal can be finalized on Ethereum. Store the transaction hash from the withdrawal transaction; you will need it to finalize the withdrawal.
Step 5) Gathering information for $ybETH withdrawal on L1
Extra information for the L2 -> L1 transaction is required for the next step in claiming the $ybETH on L1. This information can be gathered by finalizeWithdrawalParams, using zksync-ethers
package
This takes the L2 withdrawal hash as parameters and returns the parameters required for finalizing a withdrawal in the next step.
Example outputs:
Step 6) Claiming the $ybETH on L1
Once the transaction in Step 4 has been finalized on L1, we can claim the withdrawn $ybETH from the Shared Bridge contract by calling its finalizeWithdrawal
function. The inputs can be found in Step 5,
Parameters | Comments |
---|---|
| Chain id for Cronos zkEVM, which is |
| The L2 batch number where the withdrawal was processed, obtained in Step 5. |
| The position in the L2 logs Merkle tree of the l2Log that was sent with the message, obtained in Step 5. |
| The L2 transaction number in the batch, in which the log was sent, obtained in Step 5. |
| The L2 withdraw data, stored in an L2 -> L1 message, obtained in Step 5. |
| The Merkle Proof, obtained in Step 5. |
Once finalizeWithdrawal
is completed, the withdrawn amount of $ybETH will go into the receiver's wallet on Ethereum.
We can use zksync-ethers
package isWithdrawalFinalized
call to confirm whether the withdrawal transaction is finalized on the L1 network.
Parameters | Comments |
---|---|
| The transaction hash of the L2 transaction includes the withdrawal transaction from Step 4 |
Step 7) Approving $ybETH to be spend by ybETH contract
On Ethereum, call approve
on the $ybETH contract, to approve the contract to spend $ybETH.
Step 8) Requesting $ETH withdrawal
On Ethereum, call requestUnbond
to request a unbonding of the staked $ETH.
Parameters | Comments |
---|---|
| The amount of $ybETH that is to be burned to unbond $ETH |
| The wallet address on ethereum to receive the receipt NFT. This NFT is needed to withdraw the $ETH once the unbond period has ended |
This will burn $ybETH and mint a receipt NFT - Veno Unstaked ETH (vnoNFT) to the _receiver
address. The unbonding procress takes 1~10 days, hold on to the NFT to claim the $ETH once it's ready. Store the tokenId of the received NFT; it is needed to withdraw the $ETH in the next steps.
Step 9) Approving NFT to be spend by ybETH contract
On Ethereum, call setApprovalForAll
on the vnoNFT contract, to approve $ybETH to transfer your vnoNFT obtained in Step 8).
Parameters | Comments |
---|---|
| $ybETH contract address on Ethereum |
| Set to "True" to grant approval. |
Step 10) Withdrawing $ETH
On Ethereum, call unbond
function on the ybETH contract to burn the receipt NFT and receive the underlying unstaked $ETH.
Parameters | Comments |
---|---|
| The tokenId of the receipt NFT, recieved in Step 7 |
| The address on Ethereum to receive $ETH |
This transaction burns the receipt NFT and sends the unstaked $ETH to the specified receiver.
Last updated