Pauses the bridge Requires GUARDIAN role
fn pause(env: soroban_sdk::Env) -> Result<(), BridgeError>
Unpauses the bridge Requires GUARDIAN role
fn unpause(env: soroban_sdk::Env) -> Result<(), BridgeError>
Upgrades the contract to a new WASM implementation
fn upgrade(
env: soroban_sdk::Env,
new_wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), BridgeError>
Returns the admin address
fn get_admin(env: soroban_sdk::Env) -> soroban_sdk::Address
Returns whether the bridge is paused
fn is_paused(env: soroban_sdk::Env) -> bool
Sets a new admin address
fn set_admin(
env: soroban_sdk::Env,
new_admin: soroban_sdk::Address,
) -> Result<(), BridgeError>
Initializes the bridge contract All roles (OPERATOR, GUARDIAN, UPGRADER) are initially granted to the admin
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
messenger: soroban_sdk::Address,
fee_recipient: soroban_sdk::Address,
)
Returns the bridge fee in basis points (type 2: burn wrapped PT)
fn get_fee_bps(env: soroban_sdk::Env) -> u32
Returns the guardian address
fn get_guardian(env: soroban_sdk::Env) -> Option
Returns the operator address
fn get_operator(env: soroban_sdk::Env) -> Option
Returns the upgrader address
fn get_upgrader(env: soroban_sdk::Env) -> Option
Sets the guardian address Guardian can: pause/unpause, emergency functions
fn set_guardian(
env: soroban_sdk::Env,
new_guardian: soroban_sdk::Address,
) -> Result<(), BridgeError>
Sets the operator address Operator can: set trusted remotes, register PTs, set rate limits, set fees
fn set_operator(
env: soroban_sdk::Env,
new_operator: soroban_sdk::Address,
) -> Result<(), BridgeError>
Sets the upgrader address Upgrader can: upgrade contracts
fn set_upgrader(
env: soroban_sdk::Env,
new_upgrader: soroban_sdk::Address,
) -> Result<(), BridgeError>
Extends the TTL of the contract instance storage to max_ttl. Anyone can call this to keep the contract alive.
fn bump_instance(env: soroban_sdk::Env)
Returns the current messenger adapter address
fn get_messenger(env: soroban_sdk::Env) -> soroban_sdk::Address
Returns the WASM hash for wrapped PT deployment
fn get_wasm_hash(env: soroban_sdk::Env) -> Option>
Sets the WASM hash for deploying new wrapped PT contracts Requires OPERATOR role
fn set_wasm_hash(
env: soroban_sdk::Env,
wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), BridgeError>
Withdraws accumulated fees for a given token to the fee recipient.
Requires OPERATOR role (matches EVM's restricted modifier).
fn withdraw_fees(
env: soroban_sdk::Env,
token: soroban_sdk::Address,
) -> Result<(), BridgeError>
Get wrapped PT address by origin
fn get_wrapped_pt(
env: soroban_sdk::Env,
origin_chain_id: u32,
origin_address: soroban_sdk::BytesN<20>,
) -> Option
Sets the bridge fee in basis points for type 2 (burn wrapped PT to bridge back to EVM) Requires OPERATOR role
fn set_bridge_fee(env: soroban_sdk::Env, fee_bps: u32) -> Result<(), BridgeError>
Sets the Axelar chain name for a given EVM chain ID. Requires OPERATOR role.
fn set_chain_name(
env: soroban_sdk::Env,
chain_id: u32,
chain_name: soroban_sdk::String,
) -> Result<(), BridgeError>
Returns the rate limit window in seconds
fn get_rate_window(env: soroban_sdk::Env) -> u64
Called by the messenger adapter to deliver a validated inbound message. Accepts auth from the current or previous messenger (grace period during migration). The caller must identify itself so we can verify and require_auth without panicking on the wrong address (Soroban's require_auth panics on failure).
fn receive_message(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
source_chain: soroban_sdk::String,
message_id: soroban_sdk::String,
source_address: soroban_sdk::String,
payload: soroban_sdk::Bytes,
) -> Result<(), BridgeError>
Returns the fee recipient
fn get_fee_recipient(env: soroban_sdk::Env) -> Option
Atomically swap the messenger adapter and snapshot its prior per-chain trusted remotes for the migration grace period.
Each messenger encodes the source sender address differently; in-flight
inbound messages from the previous messenger only validate against the
remote captured at migration time. Chains not in chains keep their
old-encoding remote under the new messenger (effectively disabled)
until a follow-up migrate_messenger adds them.
Requires OPERATOR role.
fn migrate_messenger(
env: soroban_sdk::Env,
messenger: soroban_sdk::Address,
chains: soroban_sdk::Vec,
new_remotes: soroban_sdk::Vec,
) -> Result<(), BridgeError>
Removes the Axelar chain name for a given EVM chain ID. Requires OPERATOR role.
fn remove_chain_name(env: soroban_sdk::Env, chain_id: u32) -> Result<(), BridgeError>
Sets the fee recipient address Requires OPERATOR role
fn set_fee_recipient(
env: soroban_sdk::Env,
fee_recipient: soroban_sdk::Address,
) -> Result<(), BridgeError>
Bridge wrapped PT back to EVM (return a foreign asset to its origin chain) Burns the wrapped PT and sends a message via the messenger adapter.
refund_address names the address that receives any excess gas refunded
by the underlying messenger protocol. None defaults to sender, which
matches the EVM msg.sender behaviour for EOA users while letting
contract callers route refunds to an external account.
fn bridge_back_to_evm(
env: soroban_sdk::Env,
sender: soroban_sdk::Address,
wrapped_pt: soroban_sdk::Address,
amount: i128,
target_chain_id: u32,
evm_recipient: soroban_sdk::BytesN<20>,
gas_amount: i128,
refund_address: Option,
min_amount_out: i128,
) -> Result, BridgeError>
Returns the trusted remote for a chain
fn get_trusted_remote(
env: soroban_sdk::Env,
chain: soroban_sdk::String,
) -> Option
Sets a trusted remote address for a chain Requires OPERATOR role
fn set_trusted_remote(
env: soroban_sdk::Env,
chain: soroban_sdk::String,
address: soroban_sdk::String,
) -> Result<(), BridgeError>
Sets the bridge-back fee in basis points for type 3 (lock native PT to bridge to EVM) Uses the same fee recipient as bridge fee Requires OPERATOR role
fn set_bridge_back_fee(env: soroban_sdk::Env, fee_bps: u32) -> Result<(), BridgeError>
Returns accumulated fees for a given token
Refreshes the entry's TTL when present, so an offchain watcher can keep low-traffic fee tallies alive without holding any role.
fn get_accumulated_fees(env: soroban_sdk::Env, token: soroban_sdk::Address) -> i128
Returns the locked balance of a native Stellar PT
fn get_native_pt_locked(
env: soroban_sdk::Env,
pt_address: soroban_sdk::Address,
) -> i128
Returns the effective rate limit for a specific PT Returns the per-PT volume override if set, otherwise i128::MAX (no limit). A return value of 0 means this PT is blocked (rate limit always exceeded). Window is always the global window.
Refreshes the per-PT entry's TTL when present, so an offchain watcher can keep idle PTs alive by calling this getter without holding the OPERATOR role.
fn get_rate_limit_for_pt(
env: soroban_sdk::Env,
wrapped_pt: soroban_sdk::Address,
) -> (i128, u64)
fn get_wrapped_pt_origin(
env: soroban_sdk::Env,
wrapped_pt: soroban_sdk::Address,
) -> Result, BridgeError>
Sets rate limit for a specific wrapped PT. None/unset means no limit (i128::MAX). Set to 0 to block bridging for this PT. Window is always the global window (symmetrical with EVM side). Requires OPERATOR role.
fn set_rate_limit_for_pt(
env: soroban_sdk::Env,
wrapped_pt: soroban_sdk::Address,
max_volume_per_window: i128,
) -> Result<(), BridgeError>
Bridge a native Stellar PT to EVM. Locks the PT in this contract and sends a type 3 message via the messenger.
refund_address names the address that receives any excess gas refunded
by the underlying messenger protocol. None defaults to sender, which
matches the EVM msg.sender behaviour for EOA users while letting
contract callers route refunds to an external account.
fn bridge_native_pt_to_evm(
env: soroban_sdk::Env,
sender: soroban_sdk::Address,
pt_address: soroban_sdk::Address,
amount: i128,
target_chain_id: u32,
evm_recipient: soroban_sdk::BytesN<20>,
gas_amount: i128,
refund_address: Option,
min_amount_out: i128,
) -> Result, BridgeError>
Returns the bridge-back fee in basis points (type 3: lock native PT)
fn get_bridge_back_fee_bps(env: soroban_sdk::Env) -> u32
Clears the previous messenger and the per-chain previous trusted remotes
captured at the last migrate_messenger. Symmetric with what
migrate_messenger set.
Soroban storage isn't iterable, so the caller passes the chains to free
explicitly. Any PreviousTrustedRemote(chain) entries for chains not in
chains remain in persistent storage and expire on their own via the
PREV_MSGR_PERSISTENT_TTL-aligned TTL.
fn clear_previous_messenger(
env: soroban_sdk::Env,
chains: soroban_sdk::Vec,
) -> Result<(), BridgeError>