Returns the port's balance of token_address.
token_address - Token contract address to query.Balance held by this port.
fn balance(env: soroban_sdk::Env, token_address: soroban_sdk::Address) -> i128
Replaces the Wasm of this port with new_wasm_hash.
Only the admin (the factory that deployed this port) can call this:
when invoked from the factory, its require_auth is satisfied
automatically as the invoking contract. The new Wasm must be already
uploaded to the ledger. The network emits the executable_update
system event automatically. The constructor is NOT re-run after an
upgrade, so storage migrations require a separate migrate step.
new_wasm_hash - Wasm hash of the new port implementation.Panics if the invocation is not authorized by the admin, or if
new_wasm_hash is not present in the ledger.
fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
Returns the admin address of the port.
Admin address (the factory) authorized to upgrade the port.
fn get_admin(env: soroban_sdk::Env) -> soroban_sdk::Address
Sweeps amount of a SEP-41 token from the port to to.
token_address must expose the SEP-41 token interface. Emits
SweptSep41.
token_address - SEP-41 token contract address to sweep.to - Recipient of the swept funds.amount - Amount to sweep.Panics if the invocation is not authorized by the current off-ramp, or
if the token transfer fails (insufficient balance, negative amount,
token_address is not a token, ...).
fn sweep_sep41(
env: soroban_sdk::Env,
token_address: soroban_sdk::Address,
to: soroban_sdk::Address,
amount: i128,
)
Sweeps native XLM from the port to to.
Emits SweptNative.
to - Recipient of the swept funds.amount - Amount to sweep.Panics if the invocation is not authorized by the current off-ramp, or if the token transfer fails (insufficient balance, negative amount, ...).
fn sweep_native(env: soroban_sdk::Env, to: soroban_sdk::Address, amount: i128)
Initializes the port.
admin - Admin address (the deploying factory), i.e. the only
upgrade path of the port.off_ramp - Off-ramp address authorized to sweep funds and rotate
the off-ramp.xlm - XLM token (SAC) contract address held by the port.fn __constructor(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
off_ramp: soroban_sdk::Address,
xlm: soroban_sdk::Address,
)
Returns the current off-ramp address.
Off-ramp address authorized to sweep funds and rotate the off-ramp.
fn get_off_ramp_address(env: soroban_sdk::Env) -> soroban_sdk::Address
Replaces the off-ramp address.
Emits OffRampChanged.
off_ramp - New off-ramp address.Panics if the invocation is not authorized by the current off-ramp.
fn change_off_ramp_address(env: soroban_sdk::Env, off_ramp: soroban_sdk::Address)