Contract 06b44635985d124cf794ed687469c845c18ab0b6244766f85c7b55ab1290d4ea

← Back to Index 📥 Download WASM

Meta

cliver 26.0.0#60f7458e7ecffddf2f2d91dc6d0d2db4fab03ecc
rssdkver 22.0.11#34f7f53ae31e0fd02aab436a9872e79fa671ca02
rsver 1.94.1

Instances

  • CAN4CWPWJT5GNKLDDZPWTVICRMHBR2QZT7SFQZD5Q6CBZQLHUVEYGIIV
  • CAUBVJPXQJPV5KU5CY53R262ILG7OU5KPPS7SKLPYPGVX2BYS2ES2FM5
  • CAYLEZLWPS5PKZ7B75R24AMTCFJH7IODCQGVQSTZMC55PNRAMN5FJJPI
  • CCHY2XQNGAWYM755KIM7PKE6LEMQVIVVQJIKMCAA5EFNK5NQQVP2O7A6
  • CD7BCRUD3RDIVCH2YIHDUOKBWVZJ5CGPHGZ2RLXDLNJPJSCKDNMCRIRC
  • CDCM5W7XOPAZC3FOUKKWUEY7BGLMDXPYJHBFUNBXJXYJCZNMY4JNE55E
  • CDQLKMI4X3KVSYUYOPPDXX53S5VUVWWA7TWGVCAUWEKDJRVLXLXYGPXT
  • CDY5C7DAWSXF536ORWAEXKHWSDEWOMWWQTXV32IGGJMRYDXTDLE33DSM

Interface

Burn (destroy) amount tokens from from.

Reduces total_supply accordingly.

Only the admin vault can burn shares. This keeps redemption, cooldown, fee, and PnL accounting routed through the vault withdrawal path even when optional share transfers are enabled.

Arguments

  • from – Token holder whose tokens are destroyed (must sign).
  • amount – Number of tokens to burn. Must be > 0.

Auth

Admin must authorize.

Errors

  • [ShareTokenError::NegativeAmount] if amount < 0.
  • [ShareTokenError::ZeroAmount] if amount == 0.
  • [ShareTokenError::InsufficientBalance] if from holds fewer tokens.
  • [ShareTokenError::Overflow] on arithmetic underflow.
fn burn(env: soroban_sdk::Env, from: soroban_sdk::Address, amount: i128)

Mint amount new tokens and credit them to to.

Only the admin (vault contract) may call this function. Increases total_supply accordingly.

Arguments

  • to – Recipient of the newly created tokens.
  • amount – Number of tokens to mint. Must be > 0.

Auth

The stored admin address must authorize this call.

Errors

  • [ShareTokenError::NotInitialized] if the contract has not been set up.
  • [ShareTokenError::NegativeAmount] if amount < 0.
  • [ShareTokenError::ZeroAmount] if amount == 0.
  • [ShareTokenError::Overflow] on arithmetic overflow.
fn mint(env: soroban_sdk::Env, to: soroban_sdk::Address, amount: i128)

Return the token name.

Errors

  • [ShareTokenError::NotInitialized] if the contract has not been initialized.
fn name(env: soroban_sdk::Env) -> soroban_sdk::String

Return the token symbol.

Errors

  • [ShareTokenError::NotInitialized] if the contract has not been initialized.
fn symbol(env: soroban_sdk::Env) -> soroban_sdk::String

Approve spender to transfer up to amount tokens on behalf of the caller (from).

Setting amount to 0 effectively revokes the allowance.

Zero-first rule: To prevent the well-known allowance race condition, changing a live non-zero allowance directly to another non-zero value is rejected. Callers must first set the allowance to 0, then set the new value — or use [increase_allowance] / [decrease_allowance] for atomic adjustments.

Arguments

  • from – Token holder (must sign this transaction).
  • spender – Address being authorized.
  • amount – Maximum tokens the spender may move. Must be ≥ 0.
  • expiration_ledger – Last ledger where the allowance is valid (inclusive). After this ledger, allowance reads as zero and delegated spending reverts.

Auth

from must authorize this call.

Errors

  • [ShareTokenError::NegativeAmount] if amount < 0.
  • [ShareTokenError::NonZeroAllowance] if a live non-zero allowance already exists and `amount
fn approve(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    amount: i128,
    expiration_ledger: u32,
)

Return the token balance of id.

Returns 0 for addresses that have never received tokens.

Arguments

  • id – The address to query.
fn balance(env: soroban_sdk::Env, id: soroban_sdk::Address) -> i128

Return the number of decimal places.

Errors

  • [ShareTokenError::NotInitialized] if the contract has not been initialized.
fn decimals(env: soroban_sdk::Env) -> u32

Transfer amount tokens from the caller to to.

Arguments

  • from – Sender (must sign).
  • to – Recipient.
  • amount – Number of tokens to send. Must be > 0.

Auth

from must authorize this call.

Errors

  • [ShareTokenError::NegativeAmount] if amount < 0.
  • [ShareTokenError::ZeroAmount] if amount == 0.
  • [ShareTokenError::InsufficientBalance] if from has fewer tokens than amount.
  • [ShareTokenError::Overflow] on arithmetic overflow (should never happen with valid i128 balances).
fn transfer(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: i128,
)

Return the current spending allowance granted by from to spender.

Returns 0 if no allowance has been granted or if it has been revoked.

Arguments

  • from – The token holder.
  • spender – The approved spender.
fn allowance(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    spender: soroban_sdk::Address,
) -> i128

Disabled delegated burn entrypoint.

Disabled for vault shares. Delegated out-of-vault burning can desynchronize redemption, fee, PnL, and cooldown assumptions; shares should be redeemed through the vault withdrawal path.

Arguments

  • spender – Authorized burner (must sign).
  • from – Token holder whose tokens are destroyed.
  • amount – Number of tokens to burn. Must be > 0.

Auth

No delegated burn authorization is accepted.

Errors

  • [ShareTokenError::NegativeAmount] if amount < 0.
  • [ShareTokenError::ZeroAmount] if amount == 0.
  • [ShareTokenError::TransfersDisabled] always, after amount validation.
fn burn_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    amount: i128,
)

Return the current admin address.

Errors

  • [ShareTokenError::NotInitialized] if the contract has not been initialized.
fn get_admin(env: soroban_sdk::Env) -> soroban_sdk::Address

Transfer admin rights to new_admin.

After this call, only new_admin can mint tokens and call set_admin again. The old admin loses all privileged access.

Arguments

  • new_admin – The address that will become the new admin.

Auth

The current admin must authorize this call.

Errors

  • [ShareTokenError::NotInitialized] if the contract has not been set up.
fn set_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)

Return the current total supply of outstanding tokens.

Errors

  • [ShareTokenError::NotInitialized] if the contract has not been initialized.
fn total_supply(env: soroban_sdk::Env) -> i128

Transfer amount tokens from from to to using a pre-approved allowance.

The spender's allowance is decremented by amount.

Arguments

  • spender – Account authorized to move tokens (must sign).
  • from – Token holder whose balance is debited.
  • to – Recipient.
  • amount – Number of tokens to send. Must be > 0.

Auth

spender must authorize this call.

Errors

  • [ShareTokenError::NegativeAmount] if amount < 0.
  • [ShareTokenError::ZeroAmount] if amount == 0.
  • [ShareTokenError::InsufficientAllowance] if allowance < amount.
  • [ShareTokenError::InsufficientBalance] if from balance < amount.
  • [ShareTokenError::Overflow] on arithmetic overflow.
fn transfer_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: i128,
)

Initialize the ShareToken contract.

Runs atomically at CreateContract time, preventing front-running attacks where an attacker could otherwise call initialize first and claim the admin role.

Arguments

  • admin – The vault contract address that will be allowed to mint and burn tokens (typically the deploying manager, later transferred to the vault via set_admin).
  • name – Human-readable token name (e.g. "Vault Share Token").
  • symbol – Short ticker symbol (e.g. "VST").
  • decimals – Number of decimal places (typically 7 to match Stellar native asset precision).
fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    name: soroban_sdk::String,
    symbol: soroban_sdk::String,
    decimals: u32,
)

Return true when user share transfers are enabled.

fn transfers_enabled(env: soroban_sdk::Env) -> bool

Atomically decrease the allowance granted to spender by delta.

Safe alternative to approve for lowering an existing allowance without the approval race condition. If delta exceeds the current allowance the allowance is set to 0 (floors, does not panic).

Arguments

  • from – Token holder (must sign).
  • spender – Approved spender.
  • delta – Amount to subtract. Must be > 0.
  • expiration_ledger – New expiry applied to the updated allowance.

Errors

  • [ShareTokenError::ZeroAmount] / [ShareTokenError::NegativeAmount]
fn decrease_allowance(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    delta: i128,
    expiration_ledger: u32,
)

Atomically increase the allowance granted to spender by delta.

Safe alternative to approve for raising an existing allowance without the approval race condition.

Arguments

  • from – Token holder (must sign).
  • spender – Approved spender.
  • delta – Amount to add. Must be > 0.
  • expiration_ledger – New expiry applied to the updated allowance.

Errors

  • [ShareTokenError::ZeroAmount] / [ShareTokenError::NegativeAmount]
  • [ShareTokenError::Overflow] if the resulting allowance exceeds i128::MAX.
fn increase_allowance(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    delta: i128,
    expiration_ledger: u32,
)

Enable or disable user share transfers. Admin only.

Vault deployments keep transfers disabled by default so cooldown and per-user PnL accounting remain address-accurate. Enabling transfers is an explicit vault/governance decision that makes those per-user controls informational unless the vault implements transfer-aware accounting.

fn set_transfers_enabled(env: soroban_sdk::Env, enabled: bool)

Imports

WebAssembly Text (WAT) ▶