Skip to content

Latest commit

 

History

History
190 lines (86 loc) · 6.46 KB

address_mapping.md

File metadata and controls

190 lines (86 loc) · 6.46 KB

Module 0x3::address_mapping

Resource MultiChainAddressMapping

Mapping from multi-chain address to rooch address Not including Bitcoin address, because Bitcoin address can directly hash to rooch address The mapping record is the object field, key is the multi-chain address, value is the rooch address

struct MultiChainAddressMapping has key

Resource RoochToBitcoinAddressMapping

Mapping from rooch address to bitcoin address, other chain can use new table The mapping record is the object field, key is the rooch address, value is the Bitcoin address

Constants

const ErrorUnsupportedAddress: u64 = 2;

const NAMED_MAPPING_INDEX: u64 = 0;

Function genesis_init

public(friend) fun genesis_init(_genesis_account: &signer)

Function resolve

Resolve a multi-chain address to a rooch address

Function resolve_bitcoin

Resolve a rooch address to a bitcoin address

public fun resolve_bitcoin(rooch_address: address): option::Option<bitcoin_address::BitcoinAddress>

Function resolve_bitcoin_batch

Resolve a batch rooch addresses to bitcoin addresses

public fun resolve_bitcoin_batch(rooch_addresses: vector<address>): vector<bitcoin_address::BitcoinAddress>

Function exists_mapping

Check if a multi-chain address is bound to a rooch address

Function bind_bitcoin_address_internal

public(friend) fun bind_bitcoin_address_internal(rooch_address: address, btc_address: bitcoin_address::BitcoinAddress)

Function bind_bitcoin_address_by_system

public fun bind_bitcoin_address_by_system(system: &signer, rooch_address: address, btc_address: bitcoin_address::BitcoinAddress)

Function bind_bitcoin_address

Bind a bitcoin address to a rooch address We can calculate the rooch address from bitcoin address So we call this function for record rooch address to bitcoin address mapping