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.
fn delete_thread(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
thread_id: u64,
) -> Result<(), soroban_sdk::Error>
Delete a comment.
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>