Contract 26f71e210a0bc650caed1cf60a1b96a8e96a88a682b35de2c661adcf56c43f44

← Back to Index 📥 Download WASM

Meta

cliver 26.1.0#1228cff8022b804659750b94b315932b0e0f3f6a
rssdk_spec_shaking 2
rssdkver 25.3.1#e50d95af029c83196dd122f0154bac3f1302394b
rsver 1.92.0

Instances

  • CA4BEWL7DPUKS6FX2UTLU2KDI5V2IAU4YLYFFRSD5XOWWT3UBHNGVBSG
  • CB34XA6ZHEITD7RDK2LR6KH4W2G7XO6ZNQK3SCHUVQVRY7OTE7NZ34NU
  • CB3VT73RRQANDS3NBALF4FBAYVXXN2RP343X4JS5EVHUMEEE22MLTQ3P
  • CC5Z7SEQ4ES7AVGPEPIUQPTUL47RK77A7HPL4OHJE4OKAUK5W56BH3UE
  • CCHPYIURUN5WVVZOX6MHQAAXH74LPKYZSHDUNGBNDYKCIBPEWVBVP37Y
  • CCOVLDJCH3S552AOUKS2M5AMWORG5KNPMBCS3EQI6G5RPPKQPQHB6F6G

Interface

SHARES. Protocol/bridge entrypoint — invoked by the Axelar ITS TokenManager on bridge-out with the share amount. NOT a human redeem path: calling this with a display (rebased) amount over-burns. Humans burn via burn_rebased.

This is the method the Axelar ITS MINT_BURN_FROM TokenManager invokes on bridge-out, and it destroys exactly amount_shares shares so a round-trip conserves shares 1:1 with mint_from.

ITS does NO rebased->shares conversion: it passes the caller-supplied amount verbatim to the token's burn. A bridge-out caller (or any integration that calls burn directly) MUST therefore pass SHARES — read shares_balance, not balance. Passing a rebased amount here over-burns at any share price > 1:1.

fn burn(env: soroban_sdk::Env, from: soroban_sdk::Address, amount_shares: i128)
fn name(env: soroban_sdk::Env) -> soroban_sdk::String
fn symbol(env: soroban_sdk::Env) -> soroban_sdk::String
fn approve(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    amount_rebased: i128,
    live_until_ledger: u32,
)
fn balance(env: soroban_sdk::Env, account: soroban_sdk::Address) -> i128
fn execute(
    env: soroban_sdk::Env,
    source_chain: soroban_sdk::String,
    message_id: soroban_sdk::String,
    source_address: soroban_sdk::String,
    payload: soroban_sdk::Bytes,
) -> Result<(), __BridgedRebasingTokenAxelarExecutableInterfaceError>
fn gateway(env: soroban_sdk::Env) -> soroban_sdk::Address
fn upgrade(
    env: soroban_sdk::Env,
    new_wasm_hash: soroban_sdk::BytesN<32>,
    operator: soroban_sdk::Address,
)
fn decimals(env: soroban_sdk::Env) -> u32

Returns Some(index) if the account has the specified role, where index is the position of the account for that role, and can be used to query [AccessControl::get_role_member()]. Returns None if the account does not have the specified role.

Arguments

  • e - Access to Soroban environment.
  • account - The account to check.
  • role - The role to check for.
fn has_role(
    env: soroban_sdk::Env,
    account: soroban_sdk::Address,
    role: soroban_sdk::Symbol,
) -> Option
fn token_id(env: soroban_sdk::Env) -> soroban_sdk::BytesN<32>
fn transfer(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    to: soroban_sdk::MuxedAddress,
    amount_rebased: i128,
)
fn allowance(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    spender: soroban_sdk::Address,
) -> i128

REBASED (user/display); consumes the same rebased allowance as transfer_from. amount_rebased is in display token units and is converted to shares (ceil) for the ledger move. Distinct from the SHARE-denominated bridge burn.

fn burn_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    amount_rebased: i128,
)

Returns the admin account.

Arguments

  • e - Access to Soroban environment.
fn get_admin(env: soroban_sdk::Env) -> Option
fn mint_from(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    account: soroban_sdk::Address,
    amount_shares: i128,
)

Grants a role to an account.

Arguments

  • e - Access to Soroban environment.
  • account - The account to grant the role to.
  • role - The role to grant.
  • caller - The address of the caller, must be the admin or have the RoleAdmin for the role.

Errors

  • [AccessControlError::Unauthorized] - If the caller does not have enough privileges.
  • [AccessControlError::MaxRolesExceeded] - If adding a new role would exceed the maximum allowed number of roles.

Events

  • topics - ["role_granted", role: Symbol, account: Address]
  • data - [caller: Address]
fn grant_role(
    env: soroban_sdk::Env,
    account: soroban_sdk::Address,
    role: soroban_sdk::Symbol,
    caller: soroban_sdk::Address,
)

Rate-guard velocity ceiling, in basis points of annual share-price growth.

Together with seconds_per_year, this bounds how fast the vault ratio can move per accepted update: a strict increase is admitted only if new_ratio <= last_ratio * (1 + max_apy_bps * elapsed_seconds / (seconds_per_year * 1e4)), where elapsed_seconds is the wall-time since last_ratio_update_ts. Integrators use it to bound the worst-case ratio move over any time window.

fn max_apy_bps(env: soroban_sdk::Env) -> u64

Revokes a role from an account. To revoke the caller's own role, use [AccessControl::renounce_role()] instead.

Arguments

  • e - Access to Soroban environment.
  • account - The account to revoke the role from.
  • role - The role to revoke.
  • caller - The address of the caller, must be the admin or has the RoleAdmin for the role.

Errors

  • [AccessControlError::Unauthorized] - If the caller does not have enough privileges.
  • [AccessControlError::RoleNotHeld] - If the account doesn't have the role.
  • [AccessControlError::RoleIsEmpty] - If the role has no members.

Events

  • topics - ["role_revoked", role: Symbol, account: Address]
  • data - [caller: Address]
fn revoke_role(
    env: soroban_sdk::Env,
    account: soroban_sdk::Address,
    role: soroban_sdk::Symbol,
    caller: soroban_sdk::Address,
)
fn burn_rebased(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    amount_rebased: i128,
)
fn total_supply(env: soroban_sdk::Env) -> i128
fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    upgrader: soroban_sdk::Address,
    code: soroban_sdk::String,
    name: soroban_sdk::String,
    decimals: u32,
)

Allows an account to renounce a role assigned to itself. Users can only renounce roles for their own account.

Arguments

  • e - Access to Soroban environment.
  • role - The role to renounce.
  • caller - The address of the caller, must be the account that has the role.

Errors

  • [AccessControlError::RoleNotHeld] - If the caller doesn't have the role.
  • [AccessControlError::RoleIsEmpty] - If the role has no members.

Events

  • topics - ["role_revoked", role: Symbol, account: Address]
  • data - [caller: Address]
fn renounce_role(
    env: soroban_sdk::Env,
    role: soroban_sdk::Symbol,
    caller: soroban_sdk::Address,
)
fn transfer_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount_rebased: i128,
)
fn get_axelar_its(env: soroban_sdk::Env) -> soroban_sdk::Address

Returns the admin role for a specific role. If no admin role is explicitly set, returns None.

Arguments

  • e - Access to Soroban environment.
  • role - The role to query the admin role for.
fn get_role_admin(
    env: soroban_sdk::Env,
    role: soroban_sdk::Symbol,
) -> Option

Allows the current admin to renounce their role, making the contract permanently admin-less. This is useful for decentralization purposes or when the admin role is no longer needed. Once the admin is renounced, it cannot be reinstated.

Arguments

  • e - Access to Soroban environment.

Errors

  • [AccessControlError::AdminNotSet] - If no admin account is set.

Events

  • topics - ["admin_renounced", admin: Address]
  • data - []

Notes

  • Authorization for the current admin is required.
fn renounce_admin(env: soroban_sdk::Env)

Sets admin_role as the admin role of role.

Arguments

  • e - Access to Soroban environment.
  • role - The role to set the admin for.
  • admin_role - The new admin role.

Events

  • topics - ["role_admin_changed", role: Symbol]
  • data - [previous_admin_role: Symbol, new_admin_role: Symbol]

Errors

  • [AccessControlError::AdminNotSet] - If admin account is not set.

Notes

  • Authorization for the current admin is required.
fn set_role_admin(
    env: soroban_sdk::Env,
    role: soroban_sdk::Symbol,
    admin_role: soroban_sdk::Symbol,
)
fn shares_balance(env: soroban_sdk::Env, account: soroban_sdk::Address) -> i128
fn base_to_rebased(env: soroban_sdk::Env, amount_base: i128) -> i128

Returns the account at the specified index for a given role.

A function to get all members of a role is not provided because that would be unbounded. To enumerate all members of a role, use [AccessControl::get_role_member_count()] to get the total number of members and then use [AccessControl::get_role_member()] to retrieve each member one by one.

Arguments

  • e - Access to Soroban environment.
  • role - The role to query.
  • index - The index of the account to retrieve.

Errors

  • [AccessControlError::IndexOutOfBounds] - If the index is out of bounds for the role's member list.
fn get_role_member(
    env: soroban_sdk::Env,
    role: soroban_sdk::Symbol,
    index: u32,
) -> soroban_sdk::Address
fn get_vault_ratio(env: soroban_sdk::Env) -> (i128, i128)
fn rebased_to_base(env: soroban_sdk::Env, amount_rebased: i128) -> i128

Time base (seconds per year) of the rate-guard velocity ceiling. See max_apy_bps for the exact bound this denominator participates in.

fn seconds_per_year(env: soroban_sdk::Env) -> u64
fn set_axelar_config(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    its: soroban_sdk::Address,
    gateway: soroban_sdk::Address,
    token_id: soroban_sdk::BytesN<32>,
    gas_token: soroban_sdk::Address,
    trusted_wrapper_bytes: soroban_sdk::Bytes,
    trusted_wrapper_str: soroban_sdk::String,
    trusted_source_chain: soroban_sdk::String,
)
fn get_axelar_gateway(env: soroban_sdk::Env) -> soroban_sdk::Address

Returns a vector containing all existing roles. Defaults to empty vector if no roles exist.

Arguments

  • e - Access to Soroban environment.

Notes

This function returns all roles that currently have at least one member. The maximum number of roles is limited by [MAX_ROLES].

fn get_existing_roles(env: soroban_sdk::Env) -> soroban_sdk::Vec

Initiates the admin role transfer. Admin privileges for the current admin are not revoked until the recipient accepts the transfer. Overrides the previous pending transfer if there is one.

Arguments

  • e - Access to Soroban environment.
  • new_admin - The account to transfer the admin privileges to.
  • live_until_ledger - The ledger number at which the pending transfer expires. If live_until_ledger is 0, the pending transfer is cancelled. live_until_ledger argument is implicitly bounded by the maximum allowed TTL extension for a temporary storage entry and specifying a higher value will cause the code to panic.

Errors

  • [crate::role_transfer::RoleTransferError::NoPendingTransfer] - If trying to cancel a transfer that doesn't exist.
  • [crate::role_transfer::RoleTransferError::InvalidLiveUntilLedger] - If the specified ledger is in the past.
  • [crate::role_transfer::RoleTransferError::InvalidPendingAccount] - If the specified pending account is not the same as the provided new address.
fn transfer_admin_role(
    env: soroban_sdk::Env,
    new_admin: soroban_sdk::Address,
    live_until_ledger: u32,
)
fn base_to_rebased_ceil(env: soroban_sdk::Env, amount_base: i128) -> i128
fn get_axelar_gas_token(env: soroban_sdk::Env) -> soroban_sdk::Address

Ratio-freshness signal: the ledger close-time (Unix seconds) of the last ACCEPTED share-price ratio increase.

The constructor seeds this to the DEPLOY close-time, so a fresh deploy that has never taken a ratio update reads back the deploy timestamp (which is 0 when deployed at the genesis/default ledger clock). It then advances ONLY on a STRICT ratio increase; an equal-ratio no-op (e.g. a bridge-in carrying the unchanged ratio) leaves it untouched. A value of 0 therefore means "never updated since a deploy at close-time 0" — i.e. a fresh/default deploy. Integrators use this to detect a stale ratio (the wrapped value may lag the EVM vault) or a ratio that just spiked (this timestamp jumped to ~now).

fn last_ratio_update_ts(env: soroban_sdk::Env) -> u64

Completes the 2-step admin transfer.

Arguments

  • e - Access to Soroban environment.

Events

  • topics - ["admin_transfer_completed", new_admin: Address]
  • data - [previous_admin: Address]

Errors

  • [crate::role_transfer::RoleTransferError::NoPendingTransfer] - If there is no pending transfer to accept.
  • [AccessControlError::AdminNotSet] - If admin account is not set.
fn accept_admin_transfer(env: soroban_sdk::Env)

Returns the total number of accounts that have the specified role. If the role does not exist, returns 0.

Arguments

  • e - Access to Soroban environment.
  • role - The role to get the count for.
fn get_role_member_count(env: soroban_sdk::Env, role: soroban_sdk::Symbol) -> u32
fn get_trusted_source_chain(env: soroban_sdk::Env) -> soroban_sdk::String
fn interchain_token_service(env: soroban_sdk::Env) -> soroban_sdk::Address
fn execute_with_interchain_token(
    env: soroban_sdk::Env,
    source_chain: soroban_sdk::String,
    message_id: soroban_sdk::String,
    source_address: soroban_sdk::Bytes,
    payload: soroban_sdk::Bytes,
    token_id: soroban_sdk::BytesN<32>,
    token_address: soroban_sdk::Address,
    amount: i128,
) -> Result<(), soroban_sdk::Error>

Imports

WebAssembly Text (WAT) ▶