Contract fd22f79670518e3d438c1e41927fd18682a03eba6c599f04a0720078a1c9d1b8

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.7#211569aa49c8d896877dfca1f2eb4fe9071121c8
rsver 1.81.0

Instances

  • CAQUWPBKLH7EFPCKWLOKHSPBZ4QQZXPU3WSED37MXXB3WMEX3QVNDEQG

Interface

Initialize the contract with admin, treasury, and auth addresses. Can be called once by the deploying admin to set up roles.

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    treasury: soroban_sdk::Address,
    auth: soroban_sdk::Address,
)

Create a new IAP product (admin only).

fn create_product(
    env: soroban_sdk::Env,
    product_id: soroban_sdk::Bytes,
    product_type: soroban_sdk::Bytes,
    name: soroban_sdk::Bytes,
    description: soroban_sdk::Bytes,
    price: i128,
    currency: soroban_sdk::Bytes,
    image_url: soroban_sdk::Bytes,
    metadata: soroban_sdk::Bytes,
    iap_category: IapCategory,
)

Update an existing IAP product (admin only).

fn update_product(
    env: soroban_sdk::Env,
    product_id: soroban_sdk::Bytes,
    new_type: soroban_sdk::Bytes,
    new_name: soroban_sdk::Bytes,
    new_description: soroban_sdk::Bytes,
    new_price: i128,
    new_currency: soroban_sdk::Bytes,
    new_image_url: soroban_sdk::Bytes,
    new_metadata: soroban_sdk::Bytes,
    new_category: IapCategory,
)

Delete an IAP product (admin only).

fn delete_product(env: soroban_sdk::Env, product_id: soroban_sdk::Bytes)

Retrieve IAP product details by productId.

fn get_product(
    env: soroban_sdk::Env,
    product_id: soroban_sdk::Bytes,
) -> Option

Purchase an IAP product:

  • Transfers XLM from the caller (buyer) to the treasury.
  • Records the purchase under the user's ID.
fn purchase(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    user_id: soroban_sdk::Bytes,
    product_id: soroban_sdk::Bytes,
    price: i128,
)

Imports

WebAssembly Text (WAT) ▶