Retrieves the OApp version information.
A tuple containing:
sender_version: The version of the OAppSenderreceiver_version: The version of the OAppReceiverfn oapp_version(env: soroban_sdk::Env) -> (u64, u64)
Retrieves the LayerZero endpoint address associated with the OApp.
The LayerZero endpoint address
fn endpoint(env: soroban_sdk::Env) -> soroban_sdk::Address
Retrieves the peer (OApp) associated with a corresponding endpoint.
eid - The endpoint IDThe peer address (OApp instance) associated with the corresponding endpoint
fn peer(env: soroban_sdk::Env, eid: u32) -> Option>
Sets or removes the peer address (OApp instance) for a corresponding endpoint.
eid - The endpoint IDpeer - The address of the peer to be associated with the corresponding endpoint, or None to remove the peeroperator - The authorizer addressfn set_peer(
env: soroban_sdk::Env,
eid: u32,
peer: Option>,
operator: soroban_sdk::Address,
)
Sets the delegate address for the OApp Core.
delegate - The address of the delegate to be set, or None to remove the delegateoperator - The authorizer addressfn set_delegate(
env: soroban_sdk::Env,
delegate: Option,
operator: soroban_sdk::Address,
)
Grants a role to an account. Caller must be owner or have the role's admin role.
account - The account to grant the role to.role - The role to grant.caller - The account that is granting the role. Must be owner or have the role's admin role.fn grant_role(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
role: soroban_sdk::Symbol,
caller: soroban_sdk::Address,
)
Revokes a role from an account. Caller must be owner or have the role's admin role.
account - The account to revoke the role from.role - The role to revoke.caller - The account that is revoking the role. Must be owner or have the role's admin role.fn revoke_role(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
role: soroban_sdk::Symbol,
caller: soroban_sdk::Address,
)
Allows an account to renounce a role assigned to itself. Users can only renounce roles for their own account.
role - The role to renounce.caller - The account that is renouncing the role. Must be the account itself.fn renounce_role(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
caller: soroban_sdk::Address,
)
Sets admin_role as the admin role of role. Caller must be the authorizer.
role - The role to set the admin for.admin_role - The admin role to set for the role.The admin role can be any Symbol, including one with no members. If the admin
role has no members, only the authorizer can grant/revoke the role.
fn set_role_admin(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
admin_role: soroban_sdk::Symbol,
)
Removes the admin role for a specified role. Caller must be the authorizer.
role - The role to remove the admin for.RbacError::AdminRoleNotFound - If no admin role is set for the role.fn remove_role_admin(env: soroban_sdk::Env, role: soroban_sdk::Symbol)
Returns Some(index) if the account has the specified role, where index
is the index of the account in the role. Returns None if not.
account - The account to check the role for.role - The role to check the account for.fn has_role(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
role: soroban_sdk::Symbol,
) -> Option
Returns the admin role for a specific role, or None if not set.
role - The role to get the admin for.fn get_role_admin(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
) -> Option
Returns the number of accounts that have the specified role.
role - The role to get the member count for.fn get_role_member_count(env: soroban_sdk::Env, role: soroban_sdk::Symbol) -> u32
Returns the account at the specified index for a given role.
role - The role to get the member for.index - The index of the member to get.RbacError::IndexOutOfBounds if the index is out of bounds.fn get_role_member(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
index: u32,
) -> soroban_sdk::Address
Returns all roles that currently have at least one member. Defaults to empty vector if no roles exist.
This function returns all roles that currently have at least one member.
The maximum number of roles is limited by [MAX_ROLES].
fn get_existing_roles(env: soroban_sdk::Env) -> soroban_sdk::Vec
Retrieves the enforced options for a given endpoint and message type.
eid - The endpoint IDmsg_type - The OApp message typeThe enforced options for the given endpoint and message type
fn enforced_options(
env: soroban_sdk::Env,
eid: u32,
msg_type: u32,
) -> Option
Sets or removes the enforced options for specific endpoint and message type combinations.
Only the authorizer of the OApp can call this function.
Provides a way for the OApp to enforce things like paying for PreCrime, AND/OR minimum dst lzReceive gas amounts etc.
These enforced options can vary as the potential options/execution on the remote may differ as per the msg_type.
e.g. Amount of lzReceive() gas necessary to deliver a lzCompose() message adds overhead you don't want to pay
if you are only making a standard LayerZero message ie. lzReceive() WITHOUT sendCompose().
options - A vector of EnforcedOptionParam structures specifying enforced optionsoperator - The authorizer addressfn set_enforced_options(
env: soroban_sdk::Env,
options: soroban_sdk::Vec,
operator: soroban_sdk::Address,
)
Combines options for a given endpoint and message type.
If there is an enforced lzReceive option:
eid - The endpoint IDmsg_type - The OApp message typeextra_options - Additional options passed by the callerThe combination of caller specified options AND enforced options
fn combine_options(
env: soroban_sdk::Env,
eid: u32,
msg_type: u32,
extra_options: soroban_sdk::Bytes,
) -> soroban_sdk::Bytes
fn authorizer(env: soroban_sdk::Env) -> Option
Returns the current owner address, or None if no owner is set.
fn owner(env: soroban_sdk::Env) -> Option
Returns the pending owner address for 2-step transfer, or None if no transfer is pending.
fn pending_owner(env: soroban_sdk::Env) -> Option
Transfers ownership immediately to a new address.
Use with caution - if you transfer to a wrong address, ownership is lost forever.
Consider using begin_ownership_transfer instead.
OwnerNotSet if no owner is currently setTransferInProgress if a 2-step transfer is in progressfn transfer_ownership(env: soroban_sdk::Env, new_owner: soroban_sdk::Address)
Begins an ownership transfer to a new address.
The new owner must call accept_ownership() within ttl ledgers
to complete the transfer. The pending transfer will automatically expire after.
new_owner - The proposed new ownerttl - Number of ledgers the new owner has to accept.
Use 0 to cancel a pending transfer (new_owner must match pending).OwnerNotSet if no owner is currently setNoPendingTransfer when cancelling and no pending transfer existsInvalidTtl if ttl exceeds max TTLInvalidPendingOwner when cancelling with wrong new_owner addressfn begin_ownership_transfer(
env: soroban_sdk::Env,
new_owner: soroban_sdk::Address,
ttl: u32,
)
Accepts a pending 2-step ownership transfer.
Must be called by the pending owner before the TTL expires.
NoPendingTransfer if there is no pending transfer (or it expired)fn accept_ownership(env: soroban_sdk::Env)
Permanently renounces ownership.
OwnerNotSet if no owner is currently setTransferInProgress if a 2-step transfer is in progress (cancel it first)fn renounce_ownership(env: soroban_sdk::Env)
Extends the instance TTL.
threshold - The threshold to extend the TTL (if current TTL is below this, extend).extend_to - The TTL to extend to.fn extend_instance_ttl(env: soroban_sdk::Env, threshold: u32, extend_to: u32)
Sets TTL configs for instance and persistent storage.
None values remove the corresponding config (disables auto-extension for that type)threshold <= extend_to <= MAX_TTLinstance - TTL config for instance storagepersistent - TTL config for persistent storageTtlConfigFrozen if configs are frozenInvalidTtlConfig if validation failsfn set_ttl_configs(
env: soroban_sdk::Env,
instance: Option,
persistent: Option,
)
Returns the current TTL configs as (instance_config, persistent_config).
fn ttl_configs(env: soroban_sdk::Env) -> (Option, Option)
Permanently freezes TTL configs, preventing any future modifications.
This is irreversible and provides immutability guarantees to users.
Emits TtlConfigsFrozen event.
TtlConfigAlreadyFrozen if already frozenfn freeze_ttl_configs(env: soroban_sdk::Env)
Returns whether TTL configs are frozen.
fn is_ttl_configs_frozen(env: soroban_sdk::Env) -> bool
fn __constructor(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
endpoint: soroban_sdk::Address,
delegate: soroban_sdk::Address,
)
fn quote(
env: soroban_sdk::Env,
dst_eid: u32,
msg_type: u32,
options: soroban_sdk::Bytes,
pay_in_zro: bool,
) -> MessagingFee
fn increment(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
dst_eid: u32,
msg_type: u32,
options: soroban_sdk::Bytes,
fee: MessagingFee,
)
fn set_ordered_nonce(env: soroban_sdk::Env, ordered_nonce: bool)
fn skip_inbound_nonce(
env: soroban_sdk::Env,
src_eid: u32,
sender: soroban_sdk::BytesN<32>,
nonce: u64,
)
fn withdraw(env: soroban_sdk::Env, to: soroban_sdk::Address, amount: i128)
fn eid(env: soroban_sdk::Env) -> u32
fn count(env: soroban_sdk::Env) -> u64
fn composed_count(env: soroban_sdk::Env) -> u64
fn inbound_count(env: soroban_sdk::Env, eid: u32) -> u64
fn outbound_count(env: soroban_sdk::Env, eid: u32) -> u64
fn next_nonce(
env: soroban_sdk::Env,
src_eid: u32,
sender: soroban_sdk::BytesN<32>,
) -> u64
Checks if a messaging path can be initialized for the given origin.
origin - The origin of the messageTrue if the path can be initialized, false otherwise
fn allow_initialize_path(env: soroban_sdk::Env, origin: Origin) -> bool
Entry point for receiving messages or packets from the LayerZero endpoint.
The default implementation calls clear_payload_and_transfer to validate the message
and clear it from the endpoint, then delegates to __lz_receive for application logic.
executor - The address of the executor for the received messageorigin - The origin information containing the source endpoint and sender address:src_eid: The source chain endpoint IDsender: The sender address on the source chainnonce: The nonce of the messageguid - The unique identifier for the received LayerZero messagemessage - The payload of the received messageextra_data - Additional arbitrary data provided by the corresponding executorvalue - The native token value sent with the messagefn lz_receive(
env: soroban_sdk::Env,
executor: soroban_sdk::Address,
origin: Origin,
guid: soroban_sdk::BytesN<32>,
message: soroban_sdk::Bytes,
extra_data: soroban_sdk::Bytes,
value: i128,
)
Indicates whether an address is an approved composeMsg sender to the Endpoint.
Applications can optionally choose to implement separate composeMsg senders that are NOT the bridging layer. The default sender IS the OAppReceiver implementer.
origin - The origin information containing the source endpoint and sender addressmessage - The lzReceive payloadsender - The sender address to checkTrue if the sender is a valid composeMsg sender, false otherwise
fn is_compose_msg_sender(
env: soroban_sdk::Env,
origin: Origin,
message: soroban_sdk::Bytes,
sender: soroban_sdk::Address,
) -> bool
fn lz_compose(
env: soroban_sdk::Env,
executor: soroban_sdk::Address,
from: soroban_sdk::Address,
guid: soroban_sdk::BytesN<32>,
index: u32,
message: soroban_sdk::Bytes,
extra_data: soroban_sdk::Bytes,
value: i128,
)