- Resource
MultiChainAddressMapping
- Resource
RoochToBitcoinAddressMapping
- Constants
- Function
genesis_init
- Function
resolve
- Function
resolve_bitcoin
- Function
resolve_bitcoin_batch
- Function
exists_mapping
- Function
bind_bitcoin_address_internal
- Function
bind_bitcoin_address_by_system
- Function
bind_bitcoin_address
use 0x1::option;
use 0x1::vector;
use 0x2::core_addresses;
use 0x2::object;
use 0x3::bitcoin_address;
use 0x3::multichain_address;
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
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
struct RoochToBitcoinAddressMapping has key
const ErrorMultiChainAddressInvalid: u64 = 1;
const ErrorUnsupportedAddress: u64 = 2;
const NAMED_MAPPING_INDEX: u64 = 0;
const NAMED_REVERSE_MAPPING_INDEX: u64 = 1;
public(friend) fun genesis_init(_genesis_account: &signer)
Resolve a multi-chain address to a rooch address
public fun resolve(maddress: multichain_address::MultiChainAddress): option::Option<address>
Resolve a rooch address to a bitcoin address
public fun resolve_bitcoin(rooch_address: address): option::Option<bitcoin_address::BitcoinAddress>
Resolve a batch rooch addresses to bitcoin addresses
public fun resolve_bitcoin_batch(rooch_addresses: vector<address>): vector<bitcoin_address::BitcoinAddress>
Check if a multi-chain address is bound to a rooch address
public fun exists_mapping(maddress: multichain_address::MultiChainAddress): bool
public(friend) fun bind_bitcoin_address_internal(rooch_address: address, btc_address: bitcoin_address::BitcoinAddress)
public fun bind_bitcoin_address_by_system(system: &signer, rooch_address: address, btc_address: bitcoin_address::BitcoinAddress)
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
public fun bind_bitcoin_address(btc_address: bitcoin_address::BitcoinAddress)