zkCRO
On this page, you can find the contracts and their interactions involved when bridging $CRO and $zkCRO to and from Ethereum (L1) and Cronos zkEVM (L2) and unbonding $zkCRO, it includes:
[L1 -> L2] Minting $zkCRO with $CRO
[L2 -> L1] Withdrawing $zkCRO from L2
[L1 -> L2] Minting $zkCRO with $CRO
Before we begin, please note that the decimals of $CRO on Ethereum is 8
Developers can refer to this repository for an example script on converting $CRO (on L1 - Ethereum mainnet) to $zkCRO (on L2 - Cronos zkEVM mainnet).
To bridge $CRO Ethereum mainnet (L1) -> Cronos zkEVM mainnet(L2)
, and obtain $zkCRO on L2, we would need to interact with:
$CRO token contract
$zkCRO token contract
ZkCroMintAndBridge
Step 1) Calculating the $CRO amount to bridge
On Ethereum - Using the $zkCRO contract, call theconvertToShare
function to calculating the $CRO amount to bridge:
Keep this output amount for use in later steps.
Step 2) Approving the zkCROBridge
to spend $CRO
zkCROBridge
to spend $CROOn Ethereum - Using the $CRO contract to approve
zkCROBridge contract for the amount you want to bridge to zkEVM. Note that the decimals of $CRO on Ethereum is 8
.
Step 3) Minting and Bridging $CRO to L2
On Ethereum - Using the ZkCroMintAndBridge contract, call the mintAndBridge
function:
Once done, it mints $zkCRO and bridges it to Cronos zkEVM, some of the $CRO on the Ethereum side will be consumed in the buffer range set to pay for the gas on Cronos zkEVM.
[L2 -> L1] Withdrawing $zkCRO from L2
From Cronos zkEVM mainnet (L2) -> Ethereum mainnet (L1)
To withdraw $zkCRO fromCronos zkEVM mainnet -> Ethereum mainnet
, we would need to interact with the following contract:
$zkCRO token contract:
Cronos zkEVM:
0x000000000000000000000000000000000000800a
zkChain Shared Bridge:
Ethereum : 0xD7f9f54194C633F36CCD5F3da84ad4a1c38cB2cB
Step 1) Initiating a withdrawal transaction
On Cronos zkEvm, call the withdraw
function of zkCRO token contract:
It will take at least 24 hours before the withdrawal can be finalized on Ethereum. Store the transaction hash from the withdrawal transaction for later steps.
Step 2) Gathering information for $zkCRO withdrawal on L1
Extra information for the L2 -> L1 transaction is required for the next step in claiming the $zkCRO 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 3) Claiming the $zkCRO on L1
Once the transaction in Step 1 has been finalized on L1, we can claim the withdrawn $zkCRO from the zk Chain Shared Bridge contract by calling its finalizeWithdrawal
function. The inputs can be found in Step 2,
Once finalizeWithdrawal
is completed, the withdrawn amount of $zkCRO 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.
Note - If you would like to convert $zkCRO on Ethereum to $CRO, you can do so by unstaking it to obtain the underlying $CRO staked and receive the $CRO on "Cronos EVM Mainnet" . Please refer to the following guide Unstaking $zkCRO for $CRO to complete the process.
Unstaking $zkCRO for $CRO
To redeem $zkCRO fromEthereum mainnet
and receive the underlying unstaked $CRO ( on "Cronos EVM Mainnet"), we would need to interact with the following contracts:
$zkCRO token contract
$LCRO token contract
Cronos EVM Mainnet: 0x9fae23a2700feecd5b93e43fdbc03c76aa7c08a6
vnoNFT
Cronos EVM Mainnet: 0xb15533a0bc7c530d692a9660785226dfd3633965
Step 1) Approving $zkCRO to be spend by zkCRO token contract
On Ethereum, approve $zkCRO to be spent by zkCRO contract with appropriate amount.
Step 2) Unstaking $zkCRO to recieve $LCRO
On Ethereum, call the unstake
function on the zkCRO token contract:
Once done, $LCRO token will be automatically released within 24 hours and transfer to the _receiver
address of "Cronos EVM mainnet".
Step 3) Approving $LCRO spent
On Cronos EVM mainnet, approve $LCRO to be spent by $LCRO contract with appropriate amount
Step 4) Unbonding $LCRO
On Cronos EVM mainnet, call requestUnbond
on the LCRO token contract,
Once done you will receive an NFT (vnoNFT
) in return. Wait for batch of unbonding to be processed which takes 28-32 days.
Step 5) Approving NFT to be spend by LCRO contract
On Cronos EVM mainnet, call setApprovalForAll
on the vnoNFT contract, to approve to transfer of the vnoNFT obtained in Step 4)
Step 6) Withdrawing $CRO
On Cronos EVM mainnet, call unbond
function on the LCRO token contract to burn the receipt NFT and receive the underlying unstaked $CRO.
This transaction burns the receipt NFT and sends the unstaked $CRO to the specified receiver.
Last updated