Refund a payment within 24-hour window (admin only)
fn refund(env: soroban_sdk::Env, tx_id: u64) -> Result<(), PayError>
Get current fee rate in basis points
fn fee_bps(env: soroban_sdk::Env) -> u32
Update protocol fee rate (admin only)
fn set_fee(env: soroban_sdk::Env, fee_bps: u32) -> Result<(), PayError>
Get current exchange rate
fn get_rate(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
) -> Result
Set exchange rate between two assets (admin only, TWAP oracle)
fn set_rate(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
rate: i128,
) -> Result<(), PayError>
Batch payment: send same asset to multiple recipients
fn batch_pay(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
recipients: soroban_sdk::Vec,
amounts: soroban_sdk::Vec,
asset: soroban_sdk::Address,
) -> Result, PayError>
Transfer admin role
fn set_admin(
env: soroban_sdk::Env,
new_admin: soroban_sdk::Address,
) -> Result<(), PayError>
Initialize payment system with admin and fee rate
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
fee_bps: u32,
) -> Result<(), PayError>
Get a payment receipt
fn get_receipt(env: soroban_sdk::Env, tx_id: u64) -> Option
Send a cross-asset payment If asset_in == asset_out, direct transfer with fee deduction. Otherwise, uses oracle rate for conversion.
fn send_payment(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
asset_in: soroban_sdk::Address,
asset_out: soroban_sdk::Address,
amount: i128,
) -> Result
Withdraw accumulated fees for a token (admin only)
fn withdraw_fees(
env: soroban_sdk::Env,
token: soroban_sdk::Address,
) -> Result
Get accumulated fees for a given token
fn accumulated_fees(env: soroban_sdk::Env, token: soroban_sdk::Address) -> i128