Contract e19dd194580f528b5922c279ab230fbedf5193de8b102288e139c74941447ef1

← Back to Index 📥 Download WASM

Meta

binver 0.0.1
cliver 25.1.0#a048a57a75762458b487052e0021ea704a926bee
rssdkver 25.1.1#94c2a3b3a5ded6b9cf9cef0c207bf8804f3eb294
rsver 1.90.0

Instances

  • CCUPYJDDLBADZCCDPY7TDE7N2HQD4S5XJZRWBGMF7ETNW427OXJ3EUP7
  • CDN3UBHUBFQLSKHSDCHAO6EK2G56O6O72H2M3CEHBPSM3E6MQ5QOA55T

Interface

Sets or removes a rate limit for a specific direction and endpoint.

Arguments

  • direction - The direction (Inbound or Outbound)
  • eid - The endpoint ID
  • config - The rate limit configuration, or None to remove the rate limit
  • operator - The address that must have RATE_LIMITER_MANAGER_ROLE
fn set_rate_limit(
    env: soroban_sdk::Env,
    direction: Direction,
    eid: u32,
    config: Option,
    operator: soroban_sdk::Address,
)

Returns the rate limit configuration for a direction and endpoint. Returns None if no rate limit is configured.

fn rate_limit_config(
    env: soroban_sdk::Env,
    direction: Direction,
    eid: u32,
) -> Option

Returns the current in-flight amount for a direction and endpoint.

fn rate_limit_in_flight(env: soroban_sdk::Env, direction: Direction, eid: u32) -> i128

Returns the available capacity for a direction and endpoint. Returns i128::MAX if no rate limit is configured.

fn rate_limit_capacity(env: soroban_sdk::Env, direction: Direction, eid: u32) -> i128

Sets or removes the default fee rate in basis points.

  • Some(n): sets the default fee to n basis points (must be >0 and <=10,000).
  • Some(0): rejected — use None to remove the default fee instead.
  • None: removes the default fee (effective rate becomes 0).
  • operator - The address that must have FEE_CONFIG_MANAGER_ROLE
fn set_default_fee_bps(
    env: soroban_sdk::Env,
    default_fee_bps: Option,
    operator: soroban_sdk::Address,
)

Sets or removes the fee rate for a specific destination endpoint.

  • Some(0): explicitly sets zero fee for this destination, overriding the default fee.
  • None: removes the per-destination override; falls back to the default fee.

Arguments

  • dst_eid - The destination endpoint ID
  • fee_bps - The fee rate (0-10,000), or None to remove the fee configuration
  • operator - The address that must have FEE_CONFIG_MANAGER_ROLE
fn set_fee_bps(
    env: soroban_sdk::Env,
    dst_eid: u32,
    fee_bps: Option,
    operator: soroban_sdk::Address,
)

Sets or removes the address where collected fees will be deposited.

Arguments

  • fee_deposit_address - The address to deposit fees to, or None to remove the fee deposit address
  • operator - The authorizer address
fn set_fee_deposit_address(
    env: soroban_sdk::Env,
    fee_deposit_address: Option,
    operator: soroban_sdk::Address,
)

Returns the default fee rate in basis points, if set.

fn default_fee_bps(env: soroban_sdk::Env) -> Option

Returns the fee rate for a specific destination, if set.

fn fee_bps(env: soroban_sdk::Env, dst_eid: u32) -> Option

Returns the effective fee rate for a destination (destination-specific or default).

fn effective_fee_bps(env: soroban_sdk::Env, dst_eid: u32) -> u32

Returns true if the OFT has a fee rate greater than 0 for the specified destination

fn has_oft_fee(env: soroban_sdk::Env, dst_eid: u32) -> bool

Returns the fee deposit address.

fn fee_deposit_address(env: soroban_sdk::Env) -> Option

Pauses the OFT. When paused, the OFT will reject new send/receive/quote_send/quote_oft operations.

Arguments

  • operator - The address that must have PAUSER_ROLE
fn pause(env: soroban_sdk::Env, operator: soroban_sdk::Address)

Unpauses the OFT.

Arguments

  • operator - The address that must have UNPAUSER_ROLE
fn unpause(env: soroban_sdk::Env, operator: soroban_sdk::Address)

Returns the paused state of the OFT.

fn is_paused(env: soroban_sdk::Env) -> bool
fn quote_oft(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    send_param: SendParam,
) -> (OFTLimit, soroban_sdk::Vec, OFTReceipt)

Returns the address of the underlying SEP-41 token managed by this OFT.

fn token(env: soroban_sdk::Env) -> soroban_sdk::Address

Returns the OFT messaging protocol version as (major, minor).

The version is used by off-chain tooling and peer contracts to verify wire-format compatibility.

fn oft_version(env: soroban_sdk::Env) -> (u64, u64)

Returns the shared decimals — the common decimal precision used in cross-chain messages.

Token amounts are normalized to this precision before encoding into LayerZero messages, ensuring consistent values regardless of each chain's native token decimals. For example, a token with 18 local decimals and 6 shared decimals has a conversion rate of 10^12.

fn shared_decimals(env: soroban_sdk::Env) -> u32

Returns the decimal conversion rate (10 ^ (local_decimals - shared_decimals)).

This multiplier converts between local-decimal amounts (used on-chain) and shared-decimal amounts (used in cross-chain messages). Any sub-conversion-rate remainder ("dust") is stripped before sending to avoid rounding discrepancies across chains.

fn decimal_conversion_rate(env: soroban_sdk::Env) -> i128

Indicates whether the caller must approve a token allowance before calling send.

  • false (default) — no separate approval step is needed.
  • true — the caller must grant a token allowance to this contract before sending (e.g., via token.approve(oft_address, amount, ...)).

Wallet and frontend integrators should check this to determine whether an approval transaction must precede the send.

fn approval_required(env: soroban_sdk::Env) -> bool

Returns the current message inspector contract address, or None if unset.

When set, the inspector's inspect method is invoked during both quote_send and send to validate the outgoing message payload and options before they reach the LayerZero endpoint.

fn msg_inspector(env: soroban_sdk::Env) -> Option

Sets or removes the message inspector contract.

The message inspector is an optional validation hook. When configured, every outbound message (from both send and quote_send) is passed to the inspector contract's inspect(contract, message, options) method. The inspector should panic to reject invalid messages, acting as an on-chain policy gate.

Pass None to remove the inspector and disable outbound validation.

Authorization

Requires the caller to be the authorizer.

Arguments

  • inspector - Address of the inspector contract, or None to remove it
  • operator - The authorizer address
fn set_msg_inspector(
    env: soroban_sdk::Env,
    inspector: Option,
    operator: soroban_sdk::Address,
)

Quotes the LayerZero messaging fee required for a cross-chain send.

Builds the outgoing message and options from send_param, then queries the LayerZero endpoint for the corresponding fee. If a message inspector is set, it will also validate the message at this stage.

Arguments

  • from - The address that would initiate the transfer
  • send_param - The proposed transfer parameters
  • pay_in_zro - true to pay the messaging fee in the ZRO token; false to pay in the chain's native token

Returns

A MessagingFee containing the native_fee and zro_fee required by the endpoint. Pass this value (or a superset) to send.

fn quote_send(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    send_param: SendParam,
    pay_in_zro: bool,
) -> MessagingFee

Executes a cross-chain token transfer via the LayerZero endpoint.

Builds the OFT message and options, then sends the message through the LayerZero endpoint.

Arguments

  • from - The token sender (must authorize the call)
  • send_param - Transfer parameters including destination chain (dst_eid), recipient (to), amount, slippage floor (min_amount_ld), extra options, and an optional compose message
  • fee - The messaging fee to pay (obtain from quote_send)
  • refund_address - Address to receive any excess fee refund

Returns

  • MessagingReceipt — the LayerZero message GUID, nonce, and fee actually consumed
  • OFTReceiptamount_sent_ld (debited) and amount_received_ld (credited on destination after dust removal / fees)
fn send(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    send_param: SendParam,
    fee: MessagingFee,
    refund_address: soroban_sdk::Address,
) -> (MessagingReceipt, OFTReceipt)
fn __constructor(
    env: soroban_sdk::Env,
    token: soroban_sdk::Address,
    shared_decimals: u32,
    oft_type: OftType,
    endpoint: soroban_sdk::Address,
    delegate: soroban_sdk::Address,
)

Returns the OFT type with its target address and configuration.

fn oft_type(env: soroban_sdk::Env) -> OftType

Retrieves the OApp version information.

Returns

A tuple containing:

  • sender_version: The version of the OAppSender
  • receiver_version: The version of the OAppReceiver
fn oapp_version(env: soroban_sdk::Env) -> (u64, u64)

Retrieves the LayerZero endpoint address associated with the OApp.

Returns

The LayerZero endpoint address

fn endpoint(env: soroban_sdk::Env) -> soroban_sdk::Address

Retrieves the peer (OApp) associated with a corresponding endpoint.

Arguments

  • eid - The endpoint ID

Returns

The 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.

Arguments

  • eid - The endpoint ID
  • peer - The address of the peer to be associated with the corresponding endpoint, or None to remove the peer
  • operator - The authorizer address
fn set_peer(
    env: soroban_sdk::Env,
    eid: u32,
    peer: Option>,
    operator: soroban_sdk::Address,
)

Sets the delegate address for the OApp Core.

Arguments

  • delegate - The address of the delegate to be set, or None to remove the delegate
  • operator - The authorizer address
fn 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.

Arguments

  • 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.

Arguments

  • 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.

Arguments

  • 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.

Arguments

  • role - The role to set the admin for.
  • admin_role - The admin role to set for the role.

Notes

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.

Arguments

  • role - The role to remove the admin for.

Errors

  • 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.

Arguments

  • 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.

Arguments

  • 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.

Arguments

  • 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.

Arguments

  • role - The role to get the member for.
  • index - The index of the member to get.

Errors

  • 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.

Notes

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

Checks if a messaging path can be initialized for the given origin.

Arguments

  • origin - The origin of the message

Returns

True if the path can be initialized, false otherwise

fn allow_initialize_path(env: soroban_sdk::Env, origin: Origin) -> bool

Retrieves the next nonce for a given source endpoint and sender address.

The path nonce starts from 1. If 0 is returned it means that there is NO nonce ordered enforcement. This is required by the off-chain executor to determine if the OApp expects message execution to be ordered. This is also enforced by the OApp. By default this is NOT enabled, i.e. next_nonce is hardcoded to return 0.

Arguments

  • src_eid - The source endpoint ID
  • sender - The sender OApp address

Returns

The next nonce

fn next_nonce(
    env: soroban_sdk::Env,
    src_eid: u32,
    sender: soroban_sdk::BytesN<32>,
) -> u64

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.

Arguments

  • executor - The address of the executor for the received message
  • origin - The origin information containing the source endpoint and sender address:
  • src_eid: The source endpoint ID
  • sender: The sender address on the source chain
  • nonce: The nonce of the message
  • guid - The unique identifier for the received LayerZero message
  • message - The payload of the received message
  • extra_data - Additional arbitrary data provided by the corresponding executor
  • value - The native token value sent with the message
fn 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.

Arguments

  • origin - The origin information containing the source endpoint and sender address
  • message - The lzReceive payload
  • sender - The sender address to check

Returns

True 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

Retrieves the enforced options for a given endpoint and message type.

Arguments

  • eid - The endpoint ID
  • msg_type - The OApp message type

Returns

The 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().

Arguments

  • options - A vector of EnforcedOptionParam structures specifying enforced options
  • operator - The authorizer address
fn 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:

  • {gas_limit: 200k, value: 1 XLM} AND a caller supplies a lzReceive option: {gas_limit: 100k, value: 0.5 XLM}
  • The resulting options will be {gas_limit: 300k, value: 1.5 XLM} when the message is executed on the remote lz_receive() function. The presence of duplicated options is handled off-chain in the verifier/executor.

Arguments

  • eid - The endpoint ID
  • msg_type - The OApp message type
  • extra_options - Additional options passed by the caller

Returns

The 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

Upgrades the contract to new WASM bytecode.

fn upgrade(
    env: soroban_sdk::Env,
    new_wasm_hash: soroban_sdk::BytesN<32>,
    operator: soroban_sdk::Address,
)

Runs migration logic after an upgrade.

fn migrate(
    env: soroban_sdk::Env,
    migration_data: soroban_sdk::Bytes,
    operator: soroban_sdk::Address,
)
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.

Panics

  • OwnerNotSet if no owner is currently set
  • TransferInProgress if a 2-step transfer is in progress
fn 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.

Arguments

  • new_owner - The proposed new owner
  • ttl - Number of ledgers the new owner has to accept. Use 0 to cancel a pending transfer (new_owner must match pending).

Panics

  • OwnerNotSet if no owner is currently set
  • NoPendingTransfer when cancelling and no pending transfer exists
  • InvalidTtl if ttl exceeds max TTL
  • InvalidPendingOwner when cancelling with wrong new_owner address
fn 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.

Panics

  • NoPendingTransfer if there is no pending transfer (or it expired)
fn accept_ownership(env: soroban_sdk::Env)

Permanently renounces ownership.

Panics

  • OwnerNotSet if no owner is currently set
  • TransferInProgress if a 2-step transfer is in progress (cancel it first)
fn renounce_ownership(env: soroban_sdk::Env)

Extends the instance TTL.

Arguments

  • 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)
  • Validates that threshold <= extend_to <= MAX_TTL

Arguments

  • instance - TTL config for instance storage
  • persistent - TTL config for persistent storage

Panics

  • TtlConfigFrozen if configs are frozen
  • InvalidTtlConfig if validation fails
fn 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.

Panics

  • TtlConfigAlreadyFrozen if already frozen
fn freeze_ttl_configs(env: soroban_sdk::Env)

Returns whether TTL configs are frozen.

fn is_ttl_configs_frozen(env: soroban_sdk::Env) -> bool

Imports

WebAssembly Text (WAT) ▶