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.
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.
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)