Bridge ETH-BSC
Zam.io’s cross-chain ERC20-BEP20 bridge
$ZAM is Zam.io’s native utility token that is intended to act as a universal cross-chain bridge between CeFi and DeFi. The token has cross-chain support on two of the world’s most popular blockchains: Ethereum (ETH) and Binance Smart Chain (BSC). With time, $ZAM token will have cross-chain support on more blockchains.
How does Zam.io’s cross-chain bridge work?
Smart contracts have a pivotal role in the operation of the cross-chain bridge. Similar to a decentralized stablecoin, the cross-chain bridge transactions are controlled by smart contracts (ETH BSC Swap Contracts) that are in charge of recording the swap pairs and exchanging ETH assets with BSC assets and vice versa.
Register swap pair
Users register swap pair for erc20 token on ETH via ETHSwapAgent(
createSwapPair
) if token is not registered.Swap service will monitor the
SwapPairRegister
event and create swap pair on BSC:create an BEP20 token on BSC
record the relation between erc20 token and bep20 token.
Swap from ETH to BSC
Once swap pair is registered, users can swap tokens from ETH to BSC.
Users call
swapBSC2ETH
via ETHSwapAgent and specify erc20 token address, amount and swap fee.Swap service will monitor the
SwapStarted
event and callfillETH2BSCSwap
via BSCSwapAgent to mint corresponding bep20 tokens to the same address that initiate the swap.
Swap from BSC to ETH
Once swap pair is registered, users can swap tokens from BSC to ETH.
Users call
swapBSC2ETH
via BSCSwapAgent and specify bep20 token address, amount and swap fee. Bep20 tokens will be burned.Swap service will monitor the
SwapStarted
event and callfillBSC2ETHSwap
via BSCSwapAgent to transfer corresponding erc20 tokens to the same address that initiate the swap.
Last updated