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:
Last updated
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:
Last updated
[L1 -> L2] Minting $zkCRO with $CRO
[L2 -> L1] Withdrawing $zkCRO from L2
Developers can refer to 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
Ethereum:
$zkCRO token contract
Ethereum:
ZkCroMintAndBridge
Ethereum:
On Ethereum - Using the , call theconvertToShare
function to calculating the $CRO amount to bridge:
_tokenAmount
The amount of $CRO to bridge, in 8
decimals. Note that additional $CRO to pay for gas on L2, We suggest to put at least 1 $CRO (i.e. adding 10^8
base unit as a buffer)
Keep this output amount for use in later steps.
zkCROBridge
to spend $CRO_l2Receiver
The address on Cronos zkEVM to receive $zkCRO
_zkCroBridgeAmount
Amount of $zkCRO to bridge (as calculated in Step 1)
_l2GasLimit
The maximum amount of gas to be used on L2. Set the value high enough or the transaction will fail
_totalCro
This value is the sum of $CRO the user wants to bridge, plus the gas fee in $zkCRO. Please include a small buffer. The contract throws an error if the buffer is zero. We suggest to put at least 1 $CRO (i.e. adding 10^8
base unit as a buffer)
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.
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:
zkChain Shared Bridge:
On Cronos zkEvm, call the withdraw
function of zkCRO token contract:
_l1Receiver
The address to recieve zkCRO on Ethereum mainnet
payable
The amount of $zkCRO to be transfer.
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.
This takes the L2 withdrawal hash as parameters and returns the parameters required for finalizing a withdrawal in the next step.
Example outputs:
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,
_chainId
Chain id for Cronos zkEVM, which is 388
_l2BatchNumber
The L2 batch number where the withdrawal was processed, obtained in Step 2.
_l2MessageIndex
The position in the L2 logs Merkle tree of the l2Log that was sent with the message, obtained in Step 2.
_l2TxNumberInBatch
The L2 transaction number in the batch, in which the log was sent, obtained in Step 2.
_message
The L2 withdraw data, stored in an L2 -> L1 message, obtained in Step 2.
_merkleProof
The Merkle Proof, obtained in Step 2.
Once finalizeWithdrawal
is completed, the withdrawn amount of $zkCRO will go into the receiver's wallet on Ethereum.
withdrawalHash
The transaction hash of the L2 transaction includes the withdrawal transaction from Step 1.
$zkCRO token contract
$LCRO token contract
vnoNFT
On Ethereum, approve $zkCRO to be spent by zkCRO contract with appropriate amount.
On Ethereum, call the unstake
function on the zkCRO token contract:
_receiver
The Cronos EVM mainnet address to receive $LCRO.
_shareAmount
The amount of $zkCRO to unstake.
Once done, $LCRO token will be automatically released within 24 hours and transfer to the _receiver
address of "Cronos EVM mainnet".
On Cronos EVM mainnet, approve $LCRO to be spent by $LCRO contract with appropriate amount
On Cronos EVM mainnet, call requestUnbond
on the LCRO token contract,
_shareAmount
The amount of $LCRO that is to be burned to unbond
_receiver
The wallet address on ethereum to receive the receipt NFT. This NFT is needed to withdraw $CRO once the unbond period has ended
Once done you will receive an NFT (vnoNFT
) in return. Wait for batch of unbonding to be processed which takes 28-32 days.
operator
$LCRO contract address on ethereum
_approved
Set to "True" to grant approval.
On Cronos EVM mainnet, call unbond
function on the LCRO token contract to burn the receipt NFT and receive the underlying unstaked $CRO.
_tokenId
The tokenId of the receipt NFT, recieved in Step 4
_receiver
The address on Cronos EVM mainnet to receive $CRO
This transaction burns the receipt NFT and sends the unstaked $CRO to the specified receiver.
On Ethereum - Using the to approve
contract for the amount you want to bridge to zkEVM. Note that the decimals of $CRO on Ethereum is 8
.
On Ethereum - Using the contract, call the mintAndBridge
function:
Cronos zkEVM:
Ethereum :
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 , using zksync-ethers
package
We can use zksync-ethers
package call to confirm whether the withdrawal transaction is finalized on the L1 network.
To redeem $zkCRO fromEthereum mainnet
and receive the underlying unstaked $CRO ( on ""), we would need to interact with the following contracts:
Ethereum:
Cronos EVM Mainnet:
Cronos EVM Mainnet:
On Cronos EVM mainnet, call setApprovalForAll
on the , to approve to transfer of the vnoNFT obtained in Step 4)