OmniBridge
OmniBridge allows the migration and return of assets instantly between all of Omnify's supported networks. Each source asset is locked on the source network and has its own distinct equivalent asset on each destination network. This equivalent asset is minted upon receiving the migrated assets, and is burned when returning it to the source network. This method ensures a 1:1 peg between source and bridged assets. Accessible from bridge.omnify.finance and app.omnify.finance/bridges

Migrating and Returning assets
The process of migrating and returning assets using OmniBridge is very straightforward. Start by downloading the OmniBridge interface from our github repo. You can find a list of all Omnify services' tiers and fees at omnify.finance/fees.
OmniBridge does not support native token bridging with "msg.value". Make sure your native tokens are wrapped into their ERC20 wrap before bridging.
In this example we will be bridging USDC from Avalanche C-Chain to Binance Smart Chain.
Bridging
Quote network fee
Omnify uses LayerZero to send and receive cross-chain messages. LayerZero requires a network fee to process these messages and get them across to the destination networks. We can learn how much LayerZero's DVN's & Executors request to process our bridge transactions by calling quote
with our payload from our OmniBridge contract.
Before we call quote
we need to know:
the destination chain's LayerZero ID
the payload message we want to send
and create the options that we will forward to LayerZero's DVNs & executors
(1) All networks' Layerzero IDs can be found in our notes file in our Github Repo.
(2) Payload message
The payload message is simply a string that contains the transaction details:
"sourceAssetAddress.sourceChainEid.msgsenderaddress.recipientAddress.amount.assetName.assetSymbol.assetDecimals.isReturningBridgedAsset.foreignEquivalentAddress"
You can dynamically deduce the payload as such:
import "../lib/openzeppelin-contracts/contracts/utils/Strings.sol";
import "../lib/solidity-stringutils/strings.sol";
using strings for *;
string public _message = '0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664.30106.0x22c4D933bf8A882b065Bb5451d1Cf9991C817560.0x6BF6D002b5140b7CE0A0a4993621ecE52271e5f0.100000.USD Coin.USDC.6.';
address _foreignEquivalent = omnibridge.lookupBridgedTokenForeignEquivalent(address(0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664), 30102);
address _bridgedEquivalent = omnibridge.lookupForeignTokenBridgedEquivalent(_foreignEquivalent, 30102);
bool isReturningBridgedAsset = (_bridgedEquivalent != address(0)) && (_bridgedEquivalent == address(0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664));
if (isReturningBridgedAsset) {
_message = string.concat(_message, "true.");
} else {
_message = string.concat(_message, "false.");
}
string _foreignEquivalentString = Strings.toHexString(uint256(uint160(_foreignEquivalent)), 20);
_message = string.concat(_message, _foreignEquivalentString);
(3) Now let's get the gas limit and create the options
uint128 public gasLimit = omnibridge.GAS_LIMIT();
bytes memory _options = omnibridge.createLzReceiveOption(gasLimit, 0);
Lets explain quote
and its structure
function quote(
uint32 _dstEid, // destination chain layerzero id, all ids can be found at our github repo notes
string memory _message, // the message we will be sending
bytes memory _options, // the options we created
bool _payInLzToken) // false
external
view
returns (
uint256 nativeFee,// the returned fee
uint256 lzTokenFee); // not needed
We can finally call quote
from our code
(uint256 nativeFee, ) = omnibridge.quote(30102, _message, _options, false);
Migrate Assets
We now have all the properties we need to call migrateAssets
.
omnibridge.migrateAssets{value : nativeFee + bridgeFee}(
address(0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664), // source token address
100000, // token amount in Wei
30102, // destination network layerzero id
address(0x6BF6D002b5140b7CE0A0a4993621ecE52271e5f0) // recipient address on destination chain
);
Bridging through OmniBridge is complete, Good Job! 👏
Last updated