Verifies authorization for the executor contract.
The public key must correspond to a registered admin and must have signed the signature_payload. Uses Ed25519 signature verification.
fn __check_auth(
env: soroban_sdk::Env,
signature_payload: soroban_sdk::BytesN<32>,
auth_data: ExecutorSignature,
auth_contexts: soroban_sdk::Vec,
) -> Result<(), soroban_sdk::Error>
Sets the paused state of the worker.
When paused, the worker will reject new job assignments (e.g., assign_job, get_fee). Existing jobs in progress are not affected.
paused - true to pause, false to unpausefn set_paused(env: soroban_sdk::Env, paused: bool)
Sets admin status for an address.
Admins can configure worker settings like fee multipliers, deposit addresses, and supported option types.
Address type requirement: Admins used for execute/compose flows (Executor) or custom account auth (DVN) must be Ed25519 accounts. Contract-type addresses cannot participate in custom account authorization. Only Ed25519 account addresses can sign for execute/compose and DVN admin operations. Contract-type admins are not supported for these flows;
admin - The address to set admin status foractive - true to add admin, false to removefn set_admin(env: soroban_sdk::Env, admin: soroban_sdk::Address, active: bool)
Sets whether a message library is supported by this worker.
Message libraries (e.g., ULN302) call workers to assign jobs. Only supported libraries can interact with this worker.
message_lib - The message library contract addresssupported - true to add support, false to remove supportfn set_supported_message_lib(
env: soroban_sdk::Env,
message_lib: soroban_sdk::Address,
supported: bool,
)
Sets allowlist status for an OApp address.
When the allowlist is empty, all OApps are allowed (unless on denylist). When the allowlist is not empty, only allowlisted OApps are allowed. Denylist always takes precedence over allowlist.
oapp - The OApp contract addressallowed - true to add to allowlist, false to removefn set_allowlist(env: soroban_sdk::Env, oapp: soroban_sdk::Address, allowed: bool)
Sets denylist status for an OApp address.
Denylisted OApps are blocked from using this worker, even if they're on the allowlist (denylist takes precedence).
oapp - The OApp contract addressdenied - true to add to denylist, false to removefn set_denylist(env: soroban_sdk::Env, oapp: soroban_sdk::Address, denied: bool)
Sets the default fee multiplier in basis points.
The multiplier is applied to base fees during fee calculation. Used when no destination-specific multiplier is configured.
admin - Admin address (must provide authorization)multiplier_bps - Multiplier in basis points (10000 = 1x, 12000 = 1.2x)fn set_default_multiplier_bps(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
multiplier_bps: u32,
)
Sets the deposit address where worker fees are collected.
When jobs are assigned, fees are directed to this address.
admin - Admin address (must provide authorization)deposit_address - Address to receive collected feesfn set_deposit_address(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
deposit_address: soroban_sdk::Address,
)
Sets supported executor option types for a destination endpoint.
admin - Admin address (must provide authorization)eid - Destination endpoint ID (chain identifier)option_types - Supported option types. Each byte represents an option type.fn set_supported_option_types(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
eid: u32,
option_types: soroban_sdk::Bytes,
)
Sets the worker fee library contract address.
The fee library calculates fees based on executor options and price feed data.
admin - Admin address (must provide authorization)worker_fee_lib - Fee library contract address implementing IExecutorFeeLibfn set_worker_fee_lib(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
worker_fee_lib: soroban_sdk::Address,
)
Sets the price feed contract address.
The price feed provides gas prices and exchange rates for cross-chain fee calculations.
admin - Admin address (must provide authorization)price_feed - Price feed contract address implementing ILayerZeroPriceFeedfn set_price_feed(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
price_feed: soroban_sdk::Address,
)
Returns whether the worker is paused.
fn paused(env: soroban_sdk::Env) -> bool
Returns whether an address is an admin.
admin - The address to checkfn is_admin(env: soroban_sdk::Env, admin: soroban_sdk::Address) -> bool
Returns all admin addresses.
fn admins(env: soroban_sdk::Env) -> soroban_sdk::Vec
Returns whether a message library is supported.
message_lib - Message library contract addressfn is_supported_message_lib(
env: soroban_sdk::Env,
message_lib: soroban_sdk::Address,
) -> bool
Returns all supported message library addresses.
Vector of supported message library contract addresses.
fn message_libs(env: soroban_sdk::Env) -> soroban_sdk::Vec
Returns whether an OApp is on the allowlist.
oapp - OApp contract addressfn is_on_allowlist(env: soroban_sdk::Env, oapp: soroban_sdk::Address) -> bool
Returns the number of addresses on the allowlist.
fn allowlist_size(env: soroban_sdk::Env) -> u32
Returns whether an OApp is on the denylist.
oapp - OApp contract addressfn is_on_denylist(env: soroban_sdk::Env, oapp: soroban_sdk::Address) -> bool
Returns whether an OApp has access control list (ACL) permission.
ACL evaluation order:
oapp - OApp contract address to checkfn has_acl(env: soroban_sdk::Env, oapp: soroban_sdk::Address) -> bool
Returns the default fee multiplier in basis points.
fn default_multiplier_bps(env: soroban_sdk::Env) -> u32
Returns the deposit address where fees are collected.
fn deposit_address(env: soroban_sdk::Env) -> Option
Returns supported option types for a destination endpoint.
eid - Destination endpoint ID (chain identifier)fn get_supported_option_types(
env: soroban_sdk::Env,
eid: u32,
) -> Option
Returns the worker fee library contract address.
fn worker_fee_lib(env: soroban_sdk::Env) -> Option
Returns the price feed contract address.
fn price_feed(env: soroban_sdk::Env) -> Option
Assigns a job to the executor and returns fee recipient information.
fn assign_job(
env: soroban_sdk::Env,
send_lib: soroban_sdk::Address,
sender: soroban_sdk::Address,
dst_eid: u32,
calldata_size: u32,
options: soroban_sdk::Bytes,
) -> FeeRecipient
Calculates the execution fee for a cross-chain message.
fn get_fee(
env: soroban_sdk::Env,
send_lib: soroban_sdk::Address,
sender: soroban_sdk::Address,
dst_eid: u32,
calldata_size: u32,
options: soroban_sdk::Bytes,
) -> i128
Sets destination-specific configurations for multiple endpoints.
fn set_dst_config(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
params: soroban_sdk::Vec,
)
Returns the destination configuration for a specific endpoint.
fn dst_config(env: soroban_sdk::Env, dst_eid: u32) -> Option
Native token drops.
Transfers native tokens to each receiver specified in the parameters and tracks the success/failure status of each transfer.
fn native_drop(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
origin: Origin,
dst_eid: u32,
oapp: soroban_sdk::Address,
native_drop_params: soroban_sdk::Vec,
)
Returns the endpoint address from storage.
fn endpoint(env: soroban_sdk::Env) -> soroban_sdk::Address
Initializes the executor contract.
Sets up ownership, worker configuration, and endpoint address.
endpoint - LayerZero Endpoint V2 contract addressowner - Contract owner addressadmins - Initial admin addresses (must not be empty)message_libs - Supported message library addresses (e.g., ULN302)price_feed - Price feed contract address for fee calculationsdefault_multiplier_bps - Default fee multiplier in basis points (10000 = 1x)worker_fee_lib - Worker fee library contract addressdeposit_address - Address to receive fee paymentsfn __constructor(
env: soroban_sdk::Env,
endpoint: soroban_sdk::Address,
owner: soroban_sdk::Address,
admins: soroban_sdk::Vec,
message_libs: soroban_sdk::Vec,
price_feed: soroban_sdk::Address,
default_multiplier_bps: u32,
worker_fee_lib: soroban_sdk::Address,
deposit_address: soroban_sdk::Address,
)
Withdraws a token from the contract to a specified address.
token - The token contract addressto - The recipient addressamount - The amount to withdrawfn withdraw_token(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
token: soroban_sdk::Address,
to: soroban_sdk::Address,
amount: i128,
)
Registers an executor helper contract with its allowed function names.
The executor helper is an intermediary contract that calls executor.require_auth()
before delegating to OApp functions. The registered address and function names are
used by validate_auth_contexts to verify authorization contexts.
helper - The executor helper contract addressallowed_functions - Function names the helper is allowed to invoke (e.g., "execute", "compose")fn set_executor_helper(
env: soroban_sdk::Env,
helper: soroban_sdk::Address,
allowed_functions: soroban_sdk::Vec,
)
Returns the registered executor helper configuration.
fn executor_helper(env: soroban_sdk::Env) -> Option
Upgrades the contract to new WASM bytecode.
fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
Runs migration logic after an upgrade.
fn migrate(env: soroban_sdk::Env, migration_data: 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