Contract b4d3d10a1023965683d6ee89b639b27ddccb1b07b84a5f58d30a059212f36259

← Back to Index 📥 Download WASM

Meta

rssdkver 25.3.1#e50d95af029c83196dd122f0154bac3f1302394b
rsver 1.91.0

Instances

  • CB5S64GDCUNRFO2HQWVDQ3MJN4332EATPRW3T2O3YNBPESCVAMSRILTW

Interface

Add governance voter.

Notes:

  • Admin only.
fn add_voter(
    env: soroban_sdk::Env,
    voter: soroban_sdk::Address,
) -> Result<(), UpgradeError>

Cast vote on active proposal.

Notes:

  • Voter must authorize.
  • Records approval for supplied hash.
fn cast_vote(
    env: soroban_sdk::Env,
    voter: soroban_sdk::Address,
    wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), UpgradeError>
fn get_admin(env: soroban_sdk::Env) -> Option
fn set_admin(
    env: soroban_sdk::Env,
    new_admin: soroban_sdk::Address,
) -> Result<(), ContractError>
fn get_base_fee(env: soroban_sdk::Env) -> Result

Remove governance voter.

Notes:

  • Admin only.
fn remove_voter(
    env: soroban_sdk::Env,
    voter: soroban_sdk::Address,
) -> Result<(), UpgradeError>
fn set_base_fee(env: soroban_sdk::Env, fee: i128) -> Result<(), ContractError>
fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    base_fee: i128,
    max_deferred_fee: i128,
) -> Result<(), ContractError>

Execute approved upgrade.

Notes:

  • Admin only.
  • Applies current passed proposal.
fn apply_upgrade(
    env: soroban_sdk::Env,
) -> Result, UpgradeError>

Cancel active proposal.

Notes:

  • Admin only.
fn cancel_proposal(env: soroban_sdk::Env) -> Result<(), UpgradeError>

Create upgrade proposal.

Notes:

  • Admin only.
  • Starts governance flow for new wasm hash.
fn propose_upgrade(
    env: soroban_sdk::Env,
    proposal_type: soroban_sdk::String,
    new_wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), UpgradeError>
fn get_deferred_fee(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
) -> Result

Settles a wallet's existing deferred protocol fee balance.

Security:

  • payer authorizes payment using the selected fee asset.
  • Anyone may settle fees on behalf of a wallet.

Notes:

  • This function settles only existing deferred fees.
  • It does not add the current transaction fee.
  • Fee conversion is performed exactly once.
  • Deferred fee balance is cleared after successful settlement.
fn settle_wallet_fee(
    env: soroban_sdk::Env,
    payer: soroban_sdk::Address,
    wallet: soroban_sdk::Address,
    fee_pref: FeePreference,
) -> Result<(), ContractError>
fn get_fee_asset_rate(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
) -> Result
fn set_fee_asset_rate(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
    rate: i128,
) -> Result<(), ContractError>
fn get_max_deferred_fee(env: soroban_sdk::Env) -> Result
fn set_max_deferred_fee(env: soroban_sdk::Env, fee: i128) -> Result<(), ContractError>
fn quote_transaction_fee(
    env: soroban_sdk::Env,
    wallet: soroban_sdk::Address,
    fee_pref: Option,
) -> Result

Handles protocol fee processing for wallet transactions.

Flow:

  • Calls quote_transaction_fee to determine how the fee should be handled.
  • If fee collection is requested and valid: → collects deferred fee + current transaction fee immediately.
  • If no fee preference is provided: → defers the current transaction fee.
  • If fee handling cannot proceed: → returns a corresponding contract error.

Notes:

  • This function is the single execution path for transaction fee handling.
  • All wallet transaction entrypoints should call this function.
  • Deferred fee state is updated atomically.
  • Fee conversion is performed exactly once to avoid rounding mismatch.
fn handle_transaction_fee(
    env: soroban_sdk::Env,
    wallet: soroban_sdk::Address,
    fee_pref: Option,
) -> Result<(), ContractError>
fn is_supported_fee_asset(env: soroban_sdk::Env, asset: soroban_sdk::Address) -> bool
fn add_supported_fee_asset(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
    rate: i128,
) -> Result<(), ContractError>

Withdraw collected protocol fees from the fee manager.

  • Allows the admin to transfer accumulated fee assets out of the contract.

Validation:

  • Caller must be admin.
  • Asset must be a supported fee asset.
  • Amount must be positive.
  • Withdrawal cannot exceed the contract's asset balance.

Emits:

  • WithdrawFeeEvent(asset, amount, to)
fn withdraw_collected_fees(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
    amount: i128,
    to: soroban_sdk::Address,
) -> Result<(), ContractError>
fn get_supported_fee_assets(
    env: soroban_sdk::Env,
) -> soroban_sdk::Vec

Returns the immediate fee amount that would be collected for a wallet transaction if the current fee decision resolves to CollectNow.

Returns:

  • Some(amount) when the transaction fee would be collected immediately.
  • None when the fee would instead be deferred or cannot proceed.

Notes:

  • This helper is primarily used by the wallet contract to pre-authorize fee token transfers before calling handle_transaction_fee.
fn get_collect_now_fee_amount(
    env: soroban_sdk::Env,
    wallet: soroban_sdk::Address,
    fee_pref: Option,
) -> Option
fn remove_supported_fee_asset(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
) -> Result<(), ContractError>

Imports

WebAssembly Text (WAT) ▶