Bridge()

    function bridge(uint256 amount) external payable override nonReentrant returns (uint256) {

This function allows anyone to trigger a bridge transaction where the consolidated fees (typically in the finalTargetToken format) will be sent to the Ethereum blockchain.

Function Arguments

Name
Type
Description

amount

uint256

This value represents the amount of tokens to bridge over from the contract on the selected chain to Ethereum

bridge

uint256

This value represents the bridge fee in native gas token units

This function requires 2 values to successfully work:

  1. Amount

    This value represents the amount of finalTargetToken you would like to bridge over. When passing the value 0, it will try to bridge the entire available amount. How to identify the available amount?

    1. Visit the CarbonVortex contract (follow the address in the relevant chain)

    2. Read finalTargetToken to find the address of the token to bridge over (if the address is null, check targetToken address instead)

    3. Check the contract balance for the token address

  2. Bridge

    This value represents the bridge fee required in order for the transaction to completely deliver the tokens on the Ethereum blockchain. How to identify the required bridge fee?

    1. Connect wallet

    2. Attempt to bridge any amount of tokens (you want to see the transaction details on your wallet signed page DO NOT SIGN THE TRANSACTION)

    3. In the wallet confirmation popup, find the value under "Param #2" as outlined in the image (you can "Cancel" the wallet popup after coping the required value)

    4. Copy the indicated value and paste it into the bridge field of the transaction. Make sure you normalize the decimal correctly to the gas token of the chain. For example, on Base, the input value should be in "ETH" units i.e. 0.000666588492010473 and not as indicated in WEI.

Example

bridge(
0, //zero will try to bridge the full available amount
0.000666588492010473 //bridge fee (some bridge require this value in WEI)

Last updated