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
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:
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?Visit the CarbonVortex contract (follow the address in the relevant chain)
Read
finalTargetToken
to find the address of the token to bridge over (if the address is null, checktargetToken
address instead)Check the contract balance for the token address
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.
bridge fee value should be set to zero (0)
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:
Visit https://wormholescan.io/
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:
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
Insert the transaction hash in the search field
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)
Copy the "Encoded VAA" as HEX
Open WormHole contract on etherscan (make sure it is set to "Write as Proxy")
Connect your wallet to etherscan
Find the function called "completeTransfer"
In the function details, you would need to do the following
Paste the "Encoded VAA" as HEX string copied before
Add
x
after the first 0
Click "Write"
You should see a transaction on your wallet. If there are no warnings, go ahead and sign it to complete the process
Last updated