Contract 2f924dcb03d59fbaa4e908a1acc2a83f6accec1735f08046ffc1a972950d3323

← Back to Index 📥 Download WASM

Meta

cliver 26.0.0#60f7458e7ecffddf2f2d91dc6d0d2db4fab03ecc
rssdkver 23.5.2#347f71141ddf69ef1873527c94ac98e79215f125
rsver 1.95.0

Instances

  • CCV4X6S5TM4IVWIIWMLK6S5J3M34B64RJTLD5TF6QKDGVJKYFZQWJ3OV

Interface

Destroys amount of tokens from from. Updates the total supply accordingly.

Arguments

  • e - Access to the Soroban environment.
  • from - The account whose tokens are destroyed.
  • amount - The amount of tokens to burn.

Errors

  • [crate::fungible::FungibleTokenError::InsufficientBalance] - When attempting to burn more tokens than from current balance.
  • [crate::fungible::FungibleTokenError::LessThanZero] - When amount < 0.

Events

  • topics - ["burn", from: Address]
  • data - [amount: i128]
fn burn(env: soroban_sdk::Env, from: soroban_sdk::Address, amount: i128)

Returns the name for this token.

Arguments

  • e - Access to Soroban environment.
fn name(env: soroban_sdk::Env) -> soroban_sdk::String

Bridges tokens to another chain

Burns tokens on the current chain and sends a cross-chain message to mint tokens on the destination chain.

Arguments

  • env - The Soroban environment
  • from - The address sending the tokens
  • destination_chain - The chain ID of the destination chain
  • amount - The amount of tokens to bridge (in base units)
  • recipient - The recipient address on the destination chain (as bytes)
  • text - Optional text message to include with the transfer

Returns

Returns the transaction ID (i128) for tracking the cross-chain transfer

fn bridge(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    destination_chain: u64,
    amount: i128,
    recipient: soroban_sdk::Bytes,
    text: soroban_sdk::Bytes,
) -> u128

Returns the symbol for this token.

Arguments

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

Arguments

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

Errors

  • [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.

Events

  • topics - ["approve", from: Address, spender: Address]
  • data - [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.

Arguments

  • 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

Returns the number of decimals used to represent amounts of this token.

Arguments

  • e - Access to Soroban environment.
fn decimals(env: soroban_sdk::Env) -> u32

Transfers amount of tokens from from to to.

Arguments

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

Errors

  • [FungibleTokenError::InsufficientBalance] - When attempting to transfer more tokens than from current balance.
  • [FungibleTokenError::LessThanZero] - When amount < 0.

Events

  • topics - ["transfer", from: Address, to: Address]
  • data - [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.

Arguments

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

Arguments

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

Errors

  • [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.

Events

  • topics - ["burn", from: Address]
  • data - [amount: i128]
fn burn_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    amount: i128,
)

Sends a message to a destination chain through the message gateway

This is a default implementation that delegates to MessageClientBase.

fn message_send(
    env: soroban_sdk::Env,
    destination_chain: u64,
    chain_data: soroban_sdk::Bytes,
    confirmations: u32,
) -> u128

Returns the total amount of tokens in circulation.

Arguments

  • e - Access to the Soroban environment.
fn total_supply(env: soroban_sdk::Env) -> i128
fn __constructor(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    name: soroban_sdk::String,
    symbol: soroban_sdk::String,
    decimals: u32,
    initial_supply: i128,
)

Approves spending of tokens from another token contract

Arguments

  • env - The Soroban environment
  • token_address - The address of the token contract to approve
  • spender - The address that will be approved to spend tokens
  • amount - The amount of tokens to approve (in base units)
  • expiration_ledger - The ledger number when the approval expires
fn approve_token(
    env: soroban_sdk::Env,
    token_address: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    amount: i128,
    expiration_ledger: u32,
)

Transfers amount of tokens from from to to using the allowance mechanism. amount is then deducted from spender allowance.

Arguments

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

Errors

  • [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.

Events

  • topics - ["transfer", from: Address, to: Address]
  • data - [amount: i128]
fn transfer_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: i128,
)
fn message_process(env: soroban_sdk::Env, request: ProcessFromGatewayRequest)

Transfers the message owner address.

Ownership is initialized atomically during __constructor by the #[default_impl] macro, so this method is only reachable after an owner has already been set. Only the current owner can authorize a transfer.

This is a default implementation that delegates to MessageClientBase.

fn set_message_owner(env: soroban_sdk::Env, new_owner: soroban_sdk::Address)

Retrieves all text messages received from cross-chain transfers

Arguments

  • env - The Soroban environment

Returns

A vector of Bytes containing all received text messages

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

Returns the active message gateway address, or None if not yet set.

fn get_message_gateway(env: soroban_sdk::Env) -> Option

Initiates a two-step gateway rotation (owner-only).

First call sets the gateway directly. Subsequent calls record a pending transfer; the new gateway must call transfer_message_gateway to complete it.

fn set_message_gateway(env: soroban_sdk::Env, contract_address: soroban_sdk::Address)

Sets project signers on the gateway for this contract

This is a default implementation that delegates to MessageClientBase.

fn set_project_signers(
    env: soroban_sdk::Env,
    signers: soroban_sdk::Vec,
    required: u32,
)

Decodes ABI-encoded bridge data using the generic ABI decoder

Arguments

  • env - The Soroban environment
  • encoded - The ABI-encoded bytes to decode

Returns

A tuple containing (recipient, amount, text)

fn decode_abi_chain_data(
    env: soroban_sdk::Env,
    encoded: soroban_sdk::Bytes,
) -> (soroban_sdk::Bytes, i128, soroban_sdk::Bytes)

Encodes bridge data into ABI format using the generic ABI encoder

Arguments

  • env - The Soroban environment
  • recipient - The recipient address on the destination chain
  • amount - The amount of tokens to bridge
  • text - Optional text message to include

Returns

ABI-encoded bytes containing the bridge data

fn encode_abi_chain_data(
    env: soroban_sdk::Env,
    recipient: soroban_sdk::Bytes,
    amount: i128,
    text: soroban_sdk::Bytes,
) -> soroban_sdk::Bytes

Sets contract relayers on the gateway for this contract

This is a default implementation that delegates to MessageClientBase.

fn set_contract_relayers(
    env: soroban_sdk::Env,
    relayers: soroban_sdk::Vec,
)

Sets message endpoints for different chains

This is a default implementation that delegates to MessageClientBase.

fn set_message_endpoints(
    env: soroban_sdk::Env,
    chains: soroban_sdk::Vec,
    endpoints: soroban_sdk::Vec,
)

Validates that a sender is authorized for a given source chain

This is a default implementation that delegates to MessageClientBase.

fn validate_chain_sender(
    env: soroban_sdk::Env,
    source_chain_id: u64,
    sender: soroban_sdk::Bytes,
)

Retrieves the endpoint address for a specific chain ID

This is a default implementation that delegates to MessageClientBase.

fn get_endpoint_by_chain_id(env: soroban_sdk::Env, chain_id: u64) -> soroban_sdk::Bytes

Completes a pending gateway rotation.

contract_address (the pending gateway) must authorize this call. Called by the gateway contract's accept_admin_transfer method.

fn transfer_message_gateway(
    env: soroban_sdk::Env,
    contract_address: soroban_sdk::Address,
)

Initializes the ClientTestV4 contract

This method is called automatically during contract registration. It sets up the contract owner, token metadata, and mints the initial supply.

Arguments

  • env - The Soroban environment
  • owner - The address that will own the contract
  • name - The name of the token
  • symbol - The symbol of the token
  • decimals - The number of decimals for the token
  • initial_supply - The initial number of tokens to mint to the owner
fn __message_client_constructor(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    name: soroban_sdk::String,
    symbol: soroban_sdk::String,
    decimals: u32,
    initial_supply: i128,
)
fn message_process_from_gateway(
    env: soroban_sdk::Env,
    request: ProcessFromGatewayRequest,
)

Imports

WebAssembly Text (WAT) ▶