Destroys amount of tokens from from. Updates the total
supply accordingly.
e - Access to the Soroban environment.from - The account whose tokens are destroyed.amount - The amount of tokens to burn.crate::fungible::FungibleTokenError::InsufficientBalance] - When
attempting to burn more tokens than from current balance.crate::fungible::FungibleTokenError::LessThanZero] - When amount < 0.["burn", from: Address][amount: i128]fn burn(env: soroban_sdk::Env, from: soroban_sdk::Address, amount: i128)
Returns the name for this token.
e - Access to Soroban environment.fn name(env: soroban_sdk::Env) -> soroban_sdk::String
Returns the symbol for this token.
e - Access to Soroban environment.fn symbol(env: soroban_sdk::Env) -> soroban_sdk::String
Sets the amount of tokens a spender is allowed to spend on behalf of
an owner. Overrides any existing allowance set between spender and
owner.
e - Access to Soroban environment.owner - The address holding the tokens.spender - The address authorized to spend the tokens.amount - The amount of tokens made available to spender.live_until_ledger - The ledger number at which the allowance
expires.FungibleTokenError::InvalidLiveUntilLedger] - Occurs when
attempting to set live_until_ledger that is less than the current
ledger number and greater than 0.FungibleTokenError::LessThanZero] - Occurs when amount < 0.["approve", from: Address, spender: Address][amount: i128, live_until_ledger: u32]fn approve(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
spender: soroban_sdk::Address,
amount: i128,
live_until_ledger: u32,
)
Returns the amount of tokens held by account.
e - Access to the Soroban environment.account - The address for which the balance is being queried.fn balance(env: soroban_sdk::Env, account: soroban_sdk::Address) -> i128
fn upgrade(
env: soroban_sdk::Env,
new_wasm_hash: soroban_sdk::BytesN<32>,
operator: soroban_sdk::Address,
)
Returns the number of decimals used to represent amounts of this token.
e - Access to Soroban environment.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.
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
Transfers amount of tokens from from to to.
e - Access to Soroban environment.from - The address holding the tokens.to - The address receiving the transferred tokens.amount - The amount of tokens to be transferred.FungibleTokenError::InsufficientBalance] - When attempting to
transfer more tokens than from current balance.FungibleTokenError::LessThanZero] - When amount < 0.["transfer", from: Address, to: Address][to_muxed_id: Option<u64>, amount: i128]fn transfer(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
to: soroban_sdk::MuxedAddress,
amount: i128,
)
Returns the amount of tokens a spender is allowed to spend on behalf
of an owner.
e - Access to Soroban environment.owner - The address holding the tokens.spender - The address authorized to spend the tokens.fn allowance(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
spender: soroban_sdk::Address,
) -> i128
Destroys amount of tokens from from. Updates the total
supply accordingly.
e - Access to the Soroban environment.spender - The address authorized to burn the tokens.from - The account whose tokens are destroyed.amount - The amount of tokens to burn.crate::fungible::FungibleTokenError::InsufficientBalance] - When
attempting to burn more tokens than from current balance.crate::fungible::FungibleTokenError::InsufficientAllowance] - When
attempting to burn more tokens than from allowance.crate::fungible::FungibleTokenError::LessThanZero] - When amount < 0.["burn", from: Address][amount: i128]fn burn_from(
env: soroban_sdk::Env,
spender: soroban_sdk::Address,
from: soroban_sdk::Address,
amount: i128,
)
Returns the admin account.
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: i128,
)
Grants a role to an account.
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.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.["role_granted", role: Symbol, account: Address][caller: Address]fn grant_role(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
role: soroban_sdk::Symbol,
caller: soroban_sdk::Address,
)
Revokes a role from an account.
To revoke the caller's own role, use
[AccessControl::renounce_role()] instead.
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.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.["role_revoked", role: Symbol, account: Address][caller: Address]fn revoke_role(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
role: soroban_sdk::Symbol,
caller: soroban_sdk::Address,
)
Returns the total amount of tokens in circulation.
e - Access to the Soroban environment.fn total_supply(env: soroban_sdk::Env) -> i128
fn __constructor(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
upgrader: soroban_sdk::Address,
minter: 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.
e - Access to Soroban environment.role - The role to renounce.caller - The address of the caller, must be the account that has the
role.AccessControlError::RoleNotHeld] - If the caller doesn't have the
role.AccessControlError::RoleIsEmpty] - If the role has no members.["role_revoked", role: Symbol, account: Address][caller: Address]fn renounce_role(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
caller: soroban_sdk::Address,
)
Transfers amount of tokens from from to to using the
allowance mechanism. amount is then deducted from spender
allowance.
e - Access to Soroban environment.spender - The address authorizing the transfer, and having its
allowance consumed during the transfer.from - The address holding the tokens which will be transferred.to - The address receiving the transferred tokens.amount - The amount of tokens to be transferred.FungibleTokenError::InsufficientBalance] - When attempting to
transfer more tokens than from current balance.FungibleTokenError::LessThanZero] - When amount < 0.FungibleTokenError::InsufficientAllowance] - When attempting to
transfer more tokens than spender current allowance.["transfer", from: Address, to: Address][amount: i128]fn transfer_from(
env: soroban_sdk::Env,
spender: soroban_sdk::Address,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
amount: i128,
)
Returns the admin role for a specific role.
If no admin role is explicitly set, returns None.
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.
e - Access to Soroban environment.AccessControlError::AdminNotSet] - If no admin account is set.["admin_renounced", admin: Address][]fn renounce_admin(env: soroban_sdk::Env)
Sets admin_role as the admin role of role.
e - Access to Soroban environment.role - The role to set the admin for.admin_role - The new admin role.["role_admin_changed", role: Symbol][previous_admin_role: Symbol, new_admin_role: Symbol]AccessControlError::AdminNotSet] - If admin account is not set.fn set_role_admin(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
admin_role: soroban_sdk::Symbol,
)
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.
e - Access to Soroban environment.role - The role to query.index - The index of the account to retrieve.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
Returns a vector containing all existing roles. Defaults to empty vector if no roles exist.
e - Access to Soroban environment.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.
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.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,
)
Completes the 2-step admin transfer.
e - Access to Soroban environment.["admin_transfer_completed", new_admin: Address][previous_admin: Address]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.
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