Contract d8c9484b5ed6d0d9635c73e746467301b07c3529bc8527e624bdc21a074f18d5

← Back to Index 📥 Download WASM

Meta

cliver 26.0.0#60f7458e7ecffddf2f2d91dc6d0d2db4fab03ecc
rssdkver 26.0.0#e1bf74ba6c3ddb591593f5eb5dfb85458ff714c1
rsver 1.94.0

Instances

  • CBNKIN4EGJDUGPZXZ4JYGMNYVAGDM2HRKFEX57RG3OLCZSMZKGPVAWFN

Interface

Read a task's current state. Public.

fn get_task(env: soroban_sdk::Env, task_id: u64) -> Task

Read the admin address.

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

Initialize the contract. Called once by the Anchor on deployment.

  • admin: the parent/OFW's Stellar address (controls approvals)
  • token: the TOKA token contract address
  • max_reward: maximum TOKA reward allowed per task (safety cap)
fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    token: soroban_sdk::Address,
    max_reward: i128,
)

Create a new task. Only callable by the admin (Anchor). Returns the new task's ID.

fn create_task(
    env: soroban_sdk::Env,
    title: soroban_sdk::String,
    reward: i128,
    earner: soroban_sdk::Address,
) -> u64

Called by the Anchor to reject a submission. Task reverts to Pending so the earner can try again.

fn reject_task(env: soroban_sdk::Env, task_id: u64)

Called by the Earner (child) to submit proof of task completion.

  • task_id: which task they're completing
  • proof_cid: IPFS CID of the proof photo
fn submit_task(env: soroban_sdk::Env, task_id: u64, proof_cid: soroban_sdk::String)

Called by the Anchor to approve a submission and trigger payment. This is the core action: it executes the token transfer.

fn approve_task(env: soroban_sdk::Env, task_id: u64)

Read total number of tasks created.

fn get_task_count(env: soroban_sdk::Env) -> u64

Update max reward cap. Admin only.

fn set_max_reward(env: soroban_sdk::Env, new_max: i128)

Imports

WebAssembly Text (WAT) ▶