Skip to main content

Port Contract On EVM L2s

Supported Chains:

ChainCanister IdContract
Bevmrp433-4qaaa-aaaar-qaf2q-cai0xDA290C4D658c767fA06c27bc2AcaD59bDFCCff4A
Bitlayerhe2gn-7qaaa-aaaar-qagaq-cai0x2AFDA75BFfE47dDE22254937ef1E81E1C32B90d9
B² Networkgsr6g-kaaaa-aaaar-qagfq-cai0xF3D7bc94095454D5F8538a808941729c9B3D3B7A
X Layergjucd-qyaaa-aaaar-qagha-cai0x1Ad8cec9E5a4A441FE407785E188AbDeb4371468
Merlingovex-5aaaa-aaaar-qaghq-cai0x1Ad8cec9E5a4A441FE407785E188AbDeb4371468
Bobepmqo-ziaaa-aaaar-qagka-cai0x21cf922c8bf60d1d11ADC8aDCFdd4BdAae9e8320
Rootstockif3hq-3iaaa-aaaar-qahga-cai0x1Ad8cec9E5a4A441FE407785E188AbDeb4371468
Bitfinitypw3ee-pyaaa-aaaar-qahva-cai0x1Ad8cec9E5a4A441FE407785E188AbDeb4371468
AILayerpk76v-yyaaa-aaaar-qahxa-cai0x1Ad8cec9E5a4A441FE407785E188AbDeb4371468

Update

generate_ticket

generate_ticket(hash: String) -> Result<(), String>
Generate an cross-chain transaction from the bitcoin network to layer 2 evm-compatible instances. 

Workflow:

1. Call the corresponding Solidity function(E.g. burnToken) from the UI and get the calculated function_hash:

  • omnity-port-solidity is the solidity implementation of Omnity Port on evm-compatible blockchains, a contract module which provides a basic access control mechanism on the runes tokens. It provides the following apis:

To destroy a amount of tokenId runes tokens from the caller:

Solidity
burnToken(string memory tokenId, uint256 amount)

Creates an event involving a certain amount (depending on the type of runes) of tokenId and assigns it to the receiver. The cross-chain application will read the event and perform the mint action on the bitcoin network.

Solidity
mintRunes(string memory tokenId, address receiver)

Creates an event to transfer a specified amount of tokenId runes tokens from the caller’s account to the receiver's account on dstChainId, with an optional memo. The cross-chain application will read the event and perform the transfer action on the bitcoin network.

Solidity
transportToken(string memory dstChainId, string memory tokenId, string memory receiver, uint256 amount, string memory memo)

Creates an event to burn a specified amount of wrapped tokenId runes tokens and withdraw the corresponding amount of underlying tokens to the receiver. The cross-chain application will read the event and perform the withdrawal action on the bitcoin network.

Solidity
redeemToken(string memory tokenId, string memory receiver, uint256 amount)

2. Put the function_hash as a parameter into generate_ticket from your dapp( either in Rust or Typescript ):

  • omnity-interoperability is the rust implementation of Omnity protocol. And you can find the details of generate_ticket in it.

3. Go to Omnity Explorer to track the generated ticket status.

Query

mint_token_status

mint_token_status(ticket_id: String) -> MintTokenStatus
Returns the status of the wrapped token minting operation on the layer 2 chain:
* Finalized { tx_hash: String } represents the operation is succeeded with the transaction hash on the layer 2 chain.
* Unknown represents the operation is not completed.

Sources : MintTokenStatus

get_chain_list

get_chain_list() -> Vec<Chain>
Retrieve a list of chains that connect with the layer 2 chain.

Sources : Chain

get_token_list

get_token_list() -> Vec<TokenResp>
Retrieve a list of tokens available on the layer 2 chain.

Sources : TokenResp

get_fee

get_fee(chain_id: ChainId) -> Option<u64>
Retrieve the transaction fee based on chain_id as the target chain.

Sources : ChainId