Bridge()

For chains that support StarGate 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 which is required in order to pay for the 2nd transaction to claim the bridged amount on the ethereum blockchain. How to identify the required bridge fee? Different chains have different bridge implementation. Follow this step closely to find the correct value to use

On Celo The Bridge process does not support automatic "claim" on ethereum and therefore require the following steps to complete the flow manually.

  1. bridge fee value should be set to zero (0)

  2. Click "write" and initiate the briding process.

However, a 2nd manual transaction is required to complete the bridge transfer and make sure funds arrive to the vault contract.

Once the transaction hash is available:

  1. Input the transaction hash to learn if the 2nd step is available (it takes 20min usually) Which should show you more information on the transaction:

  2. Once the status is no longer "in progress" and turns into "pending execution" (Copy the transaction hash, you will need it) Click the "VAA Parser" under the developer tab

  3. Insert the transaction hash in the search field

  4. You will see two boxes with long stirngs in them. Pay attention to the one of the left called "encoded VAA". Toggle the tab to show "HEX" (this will turn the string into hex)

  5. Copy the "Encoded VAA" as HEX

  6. Open WormHole contract on etherscan (make sure it is set to "Write as Proxy")

  7. Connect your wallet to etherscan

  8. Find the function called "completeTransfer"

  9. In the function details, you would need to do the following

    1. Paste the "Encoded VAA" as HEX string copied before

    2. Add x after the first 0

  10. Click "Write"

  11. You should see a transaction on your wallet. If there are no warnings, go ahead and sign it to complete the process

Last updated