Sends a composed message from an OApp to a composer.
The composer MUST assert the sender because anyone can send compose msg with this function. With the same GUID, the OApp can send compose to multiple composers at the same time.
fn send_compose(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
guid: soroban_sdk::BytesN<32>,
index: u32,
message: soroban_sdk::Bytes,
)
Clears a composed message by the composer.
This is a PULL mode versus the PUSH mode of lz_compose.
fn clear_compose(
env: soroban_sdk::Env,
composer: soroban_sdk::Address,
from: soroban_sdk::Address,
guid: soroban_sdk::BytesN<32>,
index: u32,
message: soroban_sdk::Bytes,
)
Emits an alert event when lz_compose execution fails.
Called by the executor to notify about failed compose message delivery attempts.
fn lz_compose_alert(
env: soroban_sdk::Env,
executor: soroban_sdk::Address,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
guid: soroban_sdk::BytesN<32>,
index: u32,
gas: i128,
value: i128,
message: soroban_sdk::Bytes,
extra_data: soroban_sdk::Bytes,
reason: soroban_sdk::Bytes,
)
Returns the stored hash for a composed message, or None if not queued.
fn compose_queue(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
guid: soroban_sdk::BytesN<32>,
index: u32,
) -> Option>
Skips the next expected inbound nonce without verifying.
The nonce to skip must be the next expected nonce.
fn skip(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
receiver: soroban_sdk::Address,
src_eid: u32,
sender: soroban_sdk::BytesN<32>,
nonce: u64,
)
Marks a packet as verified, but disallows execution until it is re-verified.
Requires the payload hash not been executed.
fn nilify(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
receiver: soroban_sdk::Address,
src_eid: u32,
sender: soroban_sdk::BytesN<32>,
nonce: u64,
payload_hash: Option>,
)
Marks a nonce as unexecutable and un-verifiable. The nonce can never be re-verified or executed.
fn burn(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
receiver: soroban_sdk::Address,
src_eid: u32,
sender: soroban_sdk::BytesN<32>,
nonce: u64,
payload_hash: soroban_sdk::BytesN<32>,
)
Generates the next GUID for an outbound packet.
fn next_guid(
env: soroban_sdk::Env,
sender: soroban_sdk::Address,
dst_eid: u32,
receiver: soroban_sdk::BytesN<32>,
) -> soroban_sdk::BytesN<32>
Returns the current outbound nonce for a specific destination.
fn outbound_nonce(
env: soroban_sdk::Env,
sender: soroban_sdk::Address,
dst_eid: u32,
receiver: soroban_sdk::BytesN<32>,
) -> u64
Returns the max index of the longest gapless sequence of verified message nonces.
The uninitialized value is 0. The first nonce is always 1.
Note: OApp explicitly skipped nonces count as "verified" for these purposes.
fn inbound_nonce(
env: soroban_sdk::Env,
receiver: soroban_sdk::Address,
src_eid: u32,
sender: soroban_sdk::BytesN<32>,
) -> u64
Returns the pending inbound nonces for a specific path.
fn pending_inbound_nonces(
env: soroban_sdk::Env,
receiver: soroban_sdk::Address,
src_eid: u32,
sender: soroban_sdk::BytesN<32>,
) -> soroban_sdk::Vec
Returns the payload hash for a specific inbound nonce.
fn inbound_payload_hash(
env: soroban_sdk::Env,
receiver: soroban_sdk::Address,
src_eid: u32,
sender: soroban_sdk::BytesN<32>,
nonce: u64,
) -> Option>
Registers a new message library with the endpoint.
fn register_library(env: soroban_sdk::Env, new_lib: soroban_sdk::Address)
Sets the default send library for a destination endpoint.
fn set_default_send_library(
env: soroban_sdk::Env,
dst_eid: u32,
new_lib: soroban_sdk::Address,
)
Sets the default receive library for a source endpoint.
If a grace period is provided and there was a previous library, the old library remains valid until the grace period expires.
fn set_default_receive_library(
env: soroban_sdk::Env,
src_eid: u32,
new_lib: soroban_sdk::Address,
grace_period: u64,
)
Sets or removes the default receive library timeout for a source endpoint.
If a timeout is provided, it must be valid and not expired. If no timeout is provided, the default receive library timeout is removed.
fn set_default_receive_lib_timeout(
env: soroban_sdk::Env,
src_eid: u32,
timeout: Option,
)
Sets or removes a custom send library for an OApp to a specific destination endpoint.
fn set_send_library(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
sender: soroban_sdk::Address,
dst_eid: u32,
new_lib: Option,
)
Sets or removes a custom receive library for an OApp to a specific source endpoint.
If a grace period is provided and there was a previous library, the old library remains valid until the grace period expires.
fn set_receive_library(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
receiver: soroban_sdk::Address,
src_eid: u32,
new_lib: Option,
grace_period: u64,
)
Sets or removes the custom receive library timeout for an OApp.
Allows an OApp to extend or remove the validity period of a previously set library after switching to a new one.
fn set_receive_library_timeout(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
receiver: soroban_sdk::Address,
src_eid: u32,
timeout: Option,
)
Sets the configuration for a message library.
Requires the caller to be the OApp or its delegate and the library to be registered.
fn set_config(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
oapp: soroban_sdk::Address,
lib: soroban_sdk::Address,
params: soroban_sdk::Vec,
)
Checks if a message library is registered.
fn is_registered_library(env: soroban_sdk::Env, lib: soroban_sdk::Address) -> bool
Returns the index of a message library.
fn get_library_index(env: soroban_sdk::Env, lib: soroban_sdk::Address) -> Option
Returns the number of registered message libraries.
fn registered_libraries_count(env: soroban_sdk::Env) -> u32
Returns a list of registered message libraries within the specified range.
fn get_registered_libraries(
env: soroban_sdk::Env,
start: u32,
max_count: u32,
) -> soroban_sdk::Vec
Checks if an endpoint ID is supported. Returns true only if both the default send/receive libraries are set for the given eid
fn is_supported_eid(env: soroban_sdk::Env, eid: u32) -> bool
Returns the default send library for a destination endpoint.
fn default_send_library(
env: soroban_sdk::Env,
dst_eid: u32,
) -> Option
Returns the default receive library for a source endpoint.
fn default_receive_library(
env: soroban_sdk::Env,
src_eid: u32,
) -> Option
Returns the default receive library timeout for a source endpoint.
fn default_receive_library_timeout(
env: soroban_sdk::Env,
src_eid: u32,
) -> Option
Returns the effective send library for an OApp and destination endpoint.
fn get_send_library(
env: soroban_sdk::Env,
sender: soroban_sdk::Address,
dst_eid: u32,
) -> ResolvedLibrary
Returns the effective receive library for an OApp and source endpoint.
fn get_receive_library(
env: soroban_sdk::Env,
receiver: soroban_sdk::Address,
src_eid: u32,
) -> ResolvedLibrary
Returns the receive library timeout for an OApp and source endpoint.
fn receive_library_timeout(
env: soroban_sdk::Env,
receiver: soroban_sdk::Address,
src_eid: u32,
) -> Option
Checks if a receive library is valid for an OApp and source endpoint.
fn is_valid_receive_library(
env: soroban_sdk::Env,
receiver: soroban_sdk::Address,
src_eid: u32,
actual_lib: soroban_sdk::Address,
) -> bool
Returns the configuration for a message library for a specific endpoint ID and configuration type.
fn get_config(
env: soroban_sdk::Env,
oapp: soroban_sdk::Address,
lib: soroban_sdk::Address,
eid: u32,
config_type: u32,
) -> soroban_sdk::Bytes
Quotes the messaging fee for sending a cross-chain message.
fn quote(
env: soroban_sdk::Env,
sender: soroban_sdk::Address,
params: MessagingParams,
) -> MessagingFee
Sends a cross-chain message to a destination endpoint.
OApp sender needs to transfer the fees to the endpoint before sending the message
fn send(
env: soroban_sdk::Env,
sender: soroban_sdk::Address,
params: MessagingParams,
refund_address: soroban_sdk::Address,
) -> MessagingReceipt
Verifies an inbound cross-chain message from a configured receive library.
fn verify(
env: soroban_sdk::Env,
receive_lib: soroban_sdk::Address,
origin: Origin,
receiver: soroban_sdk::Address,
payload_hash: soroban_sdk::BytesN<32>,
)
Clears a verified message from the endpoint.
This is a PULL mode versus the PUSH mode of lz_receive.
fn clear(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
origin: Origin,
receiver: soroban_sdk::Address,
guid: soroban_sdk::BytesN<32>,
message: soroban_sdk::Bytes,
)
Emits an alert event when lz_receive execution fails.
Called by the executor to notify about failed message delivery attempts.
fn lz_receive_alert(
env: soroban_sdk::Env,
executor: soroban_sdk::Address,
origin: Origin,
receiver: soroban_sdk::Address,
guid: soroban_sdk::BytesN<32>,
gas: i128,
value: i128,
message: soroban_sdk::Bytes,
extra_data: soroban_sdk::Bytes,
reason: soroban_sdk::Bytes,
)
Sets the ZRO token address for fee payments.
fn set_zro(env: soroban_sdk::Env, zro: soroban_sdk::Address)
Sets or removes a delegate address that can act on behalf of the OApp.
fn set_delegate(
env: soroban_sdk::Env,
oapp: soroban_sdk::Address,
new_delegate: Option,
)
Returns the endpoint ID.
fn eid(env: soroban_sdk::Env) -> u32
Checks if a messaging path can be/has been initialized for the given origin and receiver.
fn initializable(
env: soroban_sdk::Env,
origin: Origin,
receiver: soroban_sdk::Address,
) -> bool
Checks if a message can be verified for the given origin and receiver.
fn verifiable(
env: soroban_sdk::Env,
origin: Origin,
receiver: soroban_sdk::Address,
) -> bool
Returns the native token address used for fee payments.
fn native_token(env: soroban_sdk::Env) -> soroban_sdk::Address
Returns the ZRO token address if set.
fn zro(env: soroban_sdk::Env) -> Option
Returns the delegate address for an OApp if set.
fn delegate(
env: soroban_sdk::Env,
oapp: soroban_sdk::Address,
) -> Option
fn __constructor(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
eid: u32,
native_token: soroban_sdk::Address,
)
Recovers tokens sent to this contract by mistake.
token - The token address to recoverto - The address to send the token toamount - The amount to sendfn recover_token(
env: soroban_sdk::Env,
token: soroban_sdk::Address,
to: soroban_sdk::Address,
amount: i128,
)
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