Contract 3880e526010ebff3a78d9508a8f918a19833c5cf4534d5444b4861a8dbed6e7a

← Back to Index 📥 Download WASM

Meta

cliver 23.4.1#a152ec2488c25136808ad28277c24b3a0765ffd4
rssdkver 23.4.0#673d6c4f2368d282d25da29bda55c21b8be69ca6
rsver 1.90.0

Instances

  • CCVHP6VKXZUHPBRXIRU42YKKHFWSLUCN5RH3YLJK5INVIPFCOVPYVOVX

Interface

Constructor - called automatically during contract deployment. Sets up the admin and required token (gYBX on mainnet, BLND on testnet). Can only be called once during deployment.

fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    required_token: soroban_sdk::Address,
)

Change the admin address. Only current admin can call.

fn set_admin(
    env: soroban_sdk::Env,
    new_admin: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Get the current admin address

fn get_admin(env: soroban_sdk::Env) -> Result

Upgrade the contract to a new WASM binary. Only admin can call.

fn upgrade(
    env: soroban_sdk::Env,
    new_wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), soroban_sdk::Error>

Pause or unpause the contract. Only admin can call. When paused, no new threads or comments can be created.

fn set_paused(env: soroban_sdk::Env, paused: bool) -> Result<(), soroban_sdk::Error>

Check if the contract is paused

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

Create a new thread. Requires 5+ token balance. Returns the new thread ID.

fn create_thread(
    env: soroban_sdk::Env,
    author: soroban_sdk::Address,
    title: soroban_sdk::String,
    content: soroban_sdk::String,
) -> Result

Post a comment on a thread. Requires 5+ token balance. Returns the comment ID within the thread.

fn post_comment(
    env: soroban_sdk::Env,
    author: soroban_sdk::Address,
    thread_id: u64,
    content: soroban_sdk::String,
) -> Result

Delete a thread.

  • Admin can delete anytime
  • Author can only delete within 15 minutes (~180 ledgers)
fn delete_thread(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    thread_id: u64,
) -> Result<(), soroban_sdk::Error>

Delete a comment.

  • Admin can delete anytime
  • Author can only delete within 15 minutes (~180 ledgers)
fn delete_comment(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    thread_id: u64,
    comment_id: u64,
) -> Result<(), soroban_sdk::Error>

Get thread info

fn get_thread(
    env: soroban_sdk::Env,
    thread_id: u64,
) -> Result

Get comment info

fn get_comment(
    env: soroban_sdk::Env,
    thread_id: u64,
    comment_id: u64,
) -> Result

Get total thread count

fn get_thread_count(env: soroban_sdk::Env) -> Result

Get comment count for a thread

fn get_comment_count(env: soroban_sdk::Env, thread_id: u64) -> u64

Extend thread TTL manually (anyone can call to keep thread alive)

fn extend_thread(
    env: soroban_sdk::Env,
    thread_id: u64,
) -> Result<(), soroban_sdk::Error>

Imports

WebAssembly Text (WAT) ▶