How does oPortal work?

What is Boring oPortal

Boring oPortal is an asset cross-chain solution for two EVM compatible blockchains launched by BoringDAO. There are two types of Smart Bridge: Native Bridge and Peg Bridge.

Native Bridge

Native Bridge is a simple asset cross-chain solution, which is characterized by not requiring the issuance of intermediate assets and directly mapping the token on Ethereum to another chain.

ETH to BSC

ETH to BSC

1.First, the user Alice calls the lock function of the CrossLock contract on Ethereum.

2.The contract will lock the Token A in the contract, and then issue a Lock event. BoringDAO is running node 1, and the team of Token A is running node 2. These two nodes will monitor the Lock event of the Ethereum CrossLock contract.

3.The Bridge in the figure is a smart contract located on the BSC network. When node1 and node2 listen to the Lock event, they will call the crossMint function of the Bridge contract respectively. CrossMint uses openzeppelin's AcessControl for role assignment, and only the Crosser role can call crossMint.

4.The role will be assigned to node1 and node2. When node1 and node2 call crossMint, they are actually voting on this cross-chain behavior. Only when node1 and node2 both agree, it can pass.

5.When the vote is passed, the bridge contract will call the mint function of the BSC Token A contract. The Token A team needs to deploy the Token A contract on the BSC in advance and allow the Bridge contract to perform mint and burn operations on it.

6.If the mint function of BSC Token A is called successfully, token A will be given to the BSC address of user Alice.

BSC to ETH

BSC to ETH

1.The user calls the crossBurn function of the Bridge contract

2.The Bridge contract calls the burn function of the BSC Token A contract to burn the user's token.

3.The Bridge contract issues a CrossBurn event.

4.Node1 and node2 are run and controlled by the BoringDAO and Token A teams, respectively, and they will monitor the CrossBurn event. When node1 and node2 listen to the CrossBurn event, they will respectively call the unlock function of the CrossLock contract on Ethereum.

5.In the unlock function, the caller's permission is checked, and only node1 and node2 can call the unlock function. When the unlock function is called, node1 and node2 will vote on this cross-chain behavior. When node1 and node2 both agree, the cross-chain is only passed this time.

6.After the fifth step is passed, Token A locked in the contract is unlocked and transferred to the user Alice.

What does the partner need to do

1. Contact the BoringDAO team for more details and propose contract wishes.

2. Issue your own ERC20 token on the BSC, implement the IToken interface, and give the Bridge contract the right to call mint and burn

// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IToken is IERC20{
function mint(address to, uint amount) external returns(bool);
function burn(address from, uint amount) external returns(bool);
}

3. Obtain the Smart Bridge Node program from the BoringDAO team, and inform BoringDAO of the Ethereum account address controlled by the node. BoringDAO will grant permissions so that it can call the unlock function of the CrossLock contract and the crossMint function of the Bridge contract. At the same time, provide the address to receive the cross-chain fee.

4. Run the Smart Bridge Node, keep the node online, and ensure that there are enough ETH and BNB in ​​the account controlled by the node to call the contract.

Cost and Cross-chain fee

BoringDAO and the partner need to run Smart Bridge Node and call related contracts, which will incur costs. Therefore, the Native Bridge solution will charge cross-chain fees when users cross-chain and the charging behavior occurs in the Bridge contract. The specific amount of the fee is determined by BoringDAO and the partner.

Why is there a high risk of using the "official bridge" provided by CEX?

For a decentralized project, if it use the bridge provided by the CEX, it means that the right to mint and burn of token is in the hands of the CEX, which is in high risk. If BoringDAO and the project team 2/2 jointly run the smart contract of the oPortal bridge, there will be no independent third party that can do evil.