Contract d14e8cf2e2c07ac4237e4804a50d02c717333ab2a1a4ed63cc63228e265b0a0d

← Back to Index 📥 Download WASM

Meta

rssdkver 21.4.0#d6f5639f643d76e758beecbb0ca391f8cd304c24
rsver 1.79.0

Instances

  • CA5RXZCRGH7HCACUBO6M57E2CMEF35JVFPQWJ6LBA336WQUSFH7YFTT6
  • CAUE3RVG6QPXZJHHI6VW24SCCRA2DIYEDAAPSUGZ2PRPCF6EM74U3CUU
  • CD677VJOOQY5SMNQND7NYL64K4ZQYO24PXQSZKGTKSHXSGR2DHXWM2Q7

Interface

Initializes the Stoken contract.

Arguments

  • name - The name of the token.
  • symbol - The symbol of the token.
  • pool - The address of the pool contract.
  • underlying_asset - The address of the underlying asset associated with the token.

Panics

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.

Arguments

  • from - The address of the token owner.
  • spender - The address of the spender.

Returns

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.

Arguments

  • from - The address of the token owner.
  • spender - The address of the spender.
  • amount - The amount of tokens to increase the allowance by.
  • expiration_ledger - The time when allowance will be expired.

Panics

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.

Arguments

  • id - The address of the account.

Returns

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.

Arguments

  • id - The address of the account.

Returns

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.

Arguments

  • id - The address to check for authorization.

Returns

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).

Arguments

  • from - The address of the token sender.
  • to - The address of the token recipient.
  • amount - The amount of tokens to transfer.

Panics

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.

Arguments

  • spender - The address of the account that is authorized to spend tokens.
  • from - The address of the token sender.
  • to - The address of the token recipient.
  • amount - The amount of tokens to transfer.

Panics

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.

Arguments

  • from - The address of the token holder to clawback tokens from.
  • amount - The amount of tokens to clawback.

Panics

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.

Arguments

  • id - The address to set the authorization status for.
  • authorize - A boolean value indicating whether to authorize (true) or deauthorize (false) the id.

Panics

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

Arguments

  • id - The address of the user to mint tokens for.
  • amount - The amount of tokens to mint.

Panics

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

Arguments

  • from - The address of the token holder to burn tokens from.
  • amount_to_burn - The amount of tokens to burn.
  • amount_to_withdraw - The amount of underlying token to withdraw.
  • to - The address who accepts underlying token.

Panics

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.

Returns

The number of decimal places used by the token.

fn decimals(env: soroban_sdk::Env) -> u32

Returns the name of the token.

Returns

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.

Returns

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.

Returns

The total supply of tokens.

fn total_supply(env: soroban_sdk::Env) -> i128

Transfers tokens during a liquidation.

Arguments

  • from - The address of the sender.
  • to - The address of the recipient.
  • amount - The amount of tokens to transfer.

Panics

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.

Arguments

  • to - The address of the recipient.
  • amount - The amount of underlying asset to transfer.

Panics

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.

Returns

The address of the underlying asset.

fn underlying_asset(env: soroban_sdk::Env) -> soroban_sdk::Address

Retrieves the address of the pool.

Returns

The address of the associated pool.

fn pool(env: soroban_sdk::Env) -> soroban_sdk::Address

Imports

WebAssembly Text (WAT) ▶