Contract ad2d5b94b5fd48c662b7240cd0fc5e0579ce160628e7f827e632255e4bf810eb

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.8#f46e9e0610213bbb72285566f9dd960ff96d03d8
rsver 1.87.0

Instances

  • CAHDXTMNTBZYY7PP7MGUUGWJB4MNCJMY5ECLRB4LS3STNP7UCNK3OCJN

Interface

Initialize the contract with the native XLM token address native_token_addr should be the address of the native XLM Stellar Asset Contract

fn initialize(env: soroban_sdk::Env, native_token_addr: soroban_sdk::Address)

Add a new contact (account can only add to their own contacts)

fn add_cont(
    env: soroban_sdk::Env,
    account: soroban_sdk::Address,
    alias: soroban_sdk::String,
    address: soroban_sdk::Address,
) -> bool

Edit an existing contact (account can only edit their own contacts) Cannot edit contacts that have already been sponsored

fn edit_contact(
    env: soroban_sdk::Env,
    account: soroban_sdk::Address,
    alias: soroban_sdk::String,
    new_address: soroban_sdk::Address,
) -> bool

Delete a contact (account can only delete their own contacts) Cannot delete contacts that have already been sponsored

fn delete_contact(
    env: soroban_sdk::Env,
    account: soroban_sdk::Address,
    alias: soroban_sdk::String,
) -> bool

Get a specific contact by alias (account can only read their own contacts)

fn get_contact(
    env: soroban_sdk::Env,
    account: soroban_sdk::Address,
    alias: soroban_sdk::String,
) -> Option

Get all contacts for the account (account can only read their own contacts)

fn get_all_contacts(
    env: soroban_sdk::Env,
    account: soroban_sdk::Address,
) -> soroban_sdk::Vec

Get total number of contacts for the account

fn get_contacts_count(env: soroban_sdk::Env, account: soroban_sdk::Address) -> u32

Sponsor coffee by sending XLM equivalent to $5 USD to a contact Function will be called through a smart wallet with coffee sponsor policy attached Policy expects args: sponsor (Address), contact_alias (String)

fn spon_coff(
    env: soroban_sdk::Env,
    sponsor: soroban_sdk::Address,
    contact_alias: soroban_sdk::String,
) -> bool

Get the current coffee sponsorship amount in stroops (XLM)

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

Check if a contact has been sponsored (public function for frontend use)

fn is_contact_sponsored_by_user(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    alias: soroban_sdk::String,
) -> bool

Get all sponsored aliases for a user

fn get_sponsored_aliases(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
) -> soroban_sdk::Vec

Check if an address is already used by any contact for this user (public function for frontend use)

fn is_address_used(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    address: soroban_sdk::Address,
) -> bool

Find which alias is using a specific address (returns empty string if not found)

fn find_alias_by_address(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    address: soroban_sdk::Address,
) -> soroban_sdk::String

Imports

WebAssembly Text (WAT) ▶