Initializes the Stoken contract.
Panics with if the specified decimal value exceeds the maximum value of u8. Panics with if the contract has already been initialized. Panics if name or symbol is empty
fn initialize(
env: soroban_sdk::Env,
name: soroban_sdk::String,
symbol: soroban_sdk::String,
pool: soroban_sdk::Address,
underlying_asset: soroban_sdk::Address,
)
fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
fn version(env: soroban_sdk::Env) -> u32
Returns the amount of tokens that the spender is allowed to withdraw from the from address.
The amount of tokens that the spender is allowed to withdraw from the from address.
fn allowance(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
spender: soroban_sdk::Address,
) -> i128
Set the allowance for a spender to withdraw from the from address by a specified amount of tokens.
Panics if the caller is not authorized. Panics if the amount is negative. Panics if the updated allowance exceeds the maximum value of i128.
fn approve(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
spender: soroban_sdk::Address,
amount: i128,
expiration_ledger: u32,
)
Returns the balance of tokens for a specified id.
The balance of tokens for the specified id.
fn balance(env: soroban_sdk::Env, id: soroban_sdk::Address) -> i128
Returns the spendable balance of tokens for a specified id.
The spendable balance of tokens for the specified id.
Currently the same as balance(id)
fn spendable_balance(env: soroban_sdk::Env, id: soroban_sdk::Address) -> i128
Checks whether a specified id is authorized.
Returns true if the id is authorized, otherwise returns false
fn authorized(env: soroban_sdk::Env, id: soroban_sdk::Address) -> bool
Transfers a specified amount of tokens from one account (from) to another account (to).
Panics if the caller (from) is not authorized.
Panics if the amount is negative.
fn transfer(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
amount: i128,
)
Transfers a specified amount of tokens from the from account to the to account on behalf of the spender account.
Panics if the spender is not authorized.
Panics if the spender is not allowed to spend amount.
Panics if the amount is negative.
fn transfer_from(
env: soroban_sdk::Env,
spender: soroban_sdk::Address,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
amount: i128,
)
fn burn_from(
env: soroban_sdk::Env,
_spender: soroban_sdk::Address,
_from: soroban_sdk::Address,
_amount: i128,
)
Clawbacks a specified amount of tokens from the from account.
Panics if the amount is negative. Panics if the caller is not the pool associated with this token. Panics if overflow happens
fn clawback(env: soroban_sdk::Env, from: soroban_sdk::Address, amount: i128)
Sets the authorization status for a specified id.
Panics if the caller is not the pool associated with this token.
fn set_authorized(env: soroban_sdk::Env, id: soroban_sdk::Address, authorize: bool)
Mints a specified amount of tokens for a given id and returns total supply
Panics if the amount is negative. Panics if the caller is not the pool associated with this token.
fn mint(env: soroban_sdk::Env, to: soroban_sdk::Address, amount: i128)
Burns a specified amount of tokens from the from account and returns total supply
Panics if the amount_to_burn is negative. Panics if the caller is not the pool associated with this token.
fn burn(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
amount_to_burn: i128,
amount_to_withdraw: i128,
to: soroban_sdk::Address,
)
Returns the number of decimal places used by the token.
The number of decimal places used by the token.
fn decimals(env: soroban_sdk::Env) -> u32
Returns the name of the token.
The name of the token as a soroban_sdk::Bytes value.
fn name(env: soroban_sdk::Env) -> soroban_sdk::String
Returns the symbol of the token.
The symbol of the token as a soroban_sdk::Bytes value.
fn symbol(env: soroban_sdk::Env) -> soroban_sdk::String
Returns the total supply of tokens.
The total supply of tokens.
fn total_supply(env: soroban_sdk::Env) -> i128
Transfers tokens during a liquidation.
Panics if caller is not associated pool.
fn transfer_on_liquidation(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
amount: i128,
)
Transfers the underlying asset to the specified recipient.
Panics if the amount is negative. Panics if caller is not associated pool.
fn transfer_underlying_to(
env: soroban_sdk::Env,
to: soroban_sdk::Address,
amount: i128,
)
Retrieves the address of the underlying asset.
The address of the underlying asset.
fn underlying_asset(env: soroban_sdk::Env) -> soroban_sdk::Address
Retrieves the address of the pool.
The address of the associated pool.
fn pool(env: soroban_sdk::Env) -> soroban_sdk::Address