- Resource
AddressMapping
- Constants
- Function
genesis_init
- Function
address_mapping_handle
- Function
borrow
- Function
resolve_address
- Function
resolve_or_generate_address
- Function
reverse_resolve_address
- Function
reverse_resolve_address_with_multichain_id
- Function
exists_mapping_address
- Function
resolve
- Function
resolve_or_generate
- Function
exists_mapping
- Function
bind
- Function
bind_by_system
- Function
bind_no_check
use 0x1::option;
use 0x1::signer;
use 0x1::vector;
use 0x2::bcs;
use 0x2::context;
use 0x2::object;
use 0x2::table;
use 0x3::core_addresses;
use 0x3::multichain_address;
struct AddressMapping has key
const ErrorMultiChainAddressInvalid: u64 = 1;
public(friend) fun genesis_init(ctx: &mut context::Context, _genesis_account: &signer)
Return AddressMapping table handle, including mapping and reverse_mapping table handle
public fun address_mapping_handle(ctx: &context::Context): (object::ObjectID, object::ObjectID, object::ObjectID)
Borrow the address mapping object
public fun borrow(ctx: &context::Context): &object::Object<address_mapping::AddressMapping>
public fun resolve_address(obj: &object::Object<address_mapping::AddressMapping>, maddress: multichain_address::MultiChainAddress): option::Option<address>
public fun resolve_or_generate_address(obj: &object::Object<address_mapping::AddressMapping>, maddress: multichain_address::MultiChainAddress): address
Return the first multi chain address for the rooch address
public fun reverse_resolve_address(obj: &object::Object<address_mapping::AddressMapping>, rooch_address: address): option::Option<multichain_address::MultiChainAddress>
Return the first multi chain address for the rooch address with the same multichain id
public fun reverse_resolve_address_with_multichain_id(obj: &object::Object<address_mapping::AddressMapping>, rooch_address: address, multichain_id: u64): option::Option<multichain_address::MultiChainAddress>
public fun exists_mapping_address(obj: &object::Object<address_mapping::AddressMapping>, maddress: multichain_address::MultiChainAddress): bool
Resolve a multi-chain address to a rooch address
public fun resolve(ctx: &context::Context, maddress: multichain_address::MultiChainAddress): option::Option<address>
Resolve a multi-chain address to a rooch address, if not exists, generate a new rooch address
public fun resolve_or_generate(ctx: &context::Context, maddress: multichain_address::MultiChainAddress): address
Check if a multi-chain address is bound to a rooch address
public fun exists_mapping(ctx: &context::Context, maddress: multichain_address::MultiChainAddress): bool
Bind a multi-chain address to the sender's rooch address The caller need to ensure the relationship between the multi-chain address and the rooch address
public fun bind(ctx: &mut context::Context, sender: &signer, maddress: multichain_address::MultiChainAddress)
Bind a multi-chain address to the rooch address Called by system
public fun bind_by_system(ctx: &mut context::Context, system: &signer, rooch_address: address, maddress: multichain_address::MultiChainAddress)
Bind a rooch address to a multi-chain address
public(friend) fun bind_no_check(ctx: &mut context::Context, rooch_address: address, maddress: multichain_address::MultiChainAddress)