Contract 9305b0f1032e14366da60399707d4c3666d9cce1bb28cd32d3386549293028b5

← Back to Index 📥 Download WASM

Meta

rssdkver 25.1.1#94c2a3b3a5ded6b9cf9cef0c207bf8804f3eb294
rsver 1.91.1

Interface

Initialize the token with initial supply to the creator (legacy method)

fn init(
    env: soroban_sdk::Env,
    creator: soroban_sdk::Address,
    initial_supply: soroban_sdk::U256,
)

Mint new tokens (admin only)

fn mint(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: soroban_sdk::U256,
)

Get the current balance of an account (after applying demurrage)

fn balance(env: soroban_sdk::Env, account: soroban_sdk::Address) -> soroban_sdk::U256

Transfer tokens from one account to another

fn transfer(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: soroban_sdk::U256,
)

Get oracle data

fn get_oracle(env: soroban_sdk::Env, oracle: soroban_sdk::Address) -> OracleData

Join an existing trust

fn join_trust(
    env: soroban_sdk::Env,
    member: soroban_sdk::Address,
    trust_id: soroban_sdk::Address,
)

Get full account data

fn get_account(env: soroban_sdk::Env, account: soroban_sdk::Address) -> AccountData

Leave current trust (anti-gaming: Part 2.2 - allows escaping bad governors)

fn leave_trust(env: soroban_sdk::Env, member: soroban_sdk::Address)

Get proposal details

fn get_proposal(env: soroban_sdk::Env, proposal_id: u64) -> Proposal

Get verifier data

fn get_verifier(env: soroban_sdk::Env, verifier: soroban_sdk::Address) -> VerifierData

Get the total supply

fn total_supply(env: soroban_sdk::Env) -> soroban_sdk::U256
fn __constructor(
    env: soroban_sdk::Env,
    creator: soroban_sdk::Address,
    initial_supply: soroban_sdk::U256,
)

Set probation period for an address

fn set_probation(
    env: soroban_sdk::Env,
    address: soroban_sdk::Address,
    role: RoleType,
    duration_days: u64,
)

Get list of all registered trust IDs

fn get_all_trusts(env: soroban_sdk::Env) -> soroban_sdk::Vec

Get reputation score for a role (public)

fn get_reputation(
    env: soroban_sdk::Env,
    address: soroban_sdk::Address,
    role: RoleType,
) -> u32

Get information about a specific trust

fn get_trust_info(env: soroban_sdk::Env, trust_id: soroban_sdk::Address) -> TrustData

Get work claim details

fn get_work_claim(env: soroban_sdk::Env, claim_id: u64) -> WorkClaim

Register a new community trust Parameters:

  • governor: Address that will govern this trust
  • name: Human-readable name for the trust
  • annual_rate_bps: Annual demurrage rate in basis points (500-1500 = 5-15%)
  • demurrage_period_days: How often to apply demurrage (default: 28 days)
fn register_trust(
    env: soroban_sdk::Env,
    governor: soroban_sdk::Address,
    name: soroban_sdk::String,
    annual_rate_bps: u32,
    demurrage_period_days: u64,
)

Create a governance proposal Proposer must be a trust governor for trust-specific proposals or admin for protocol-level proposals

fn create_proposal(
    env: soroban_sdk::Env,
    proposer: soroban_sdk::Address,
    proposal_type: ProposalType,
    title: soroban_sdk::String,
    description: soroban_sdk::String,
    trust_id: Option,
    new_rate_bps: Option,
    target_address: Option,
) -> u64

Check if address is in probation for a role (public)

fn is_on_probation(
    env: soroban_sdk::Env,
    address: soroban_sdk::Address,
    role: RoleType,
) -> bool

Register as a grace period oracle Oracles can activate grace periods for accounts in hardship

fn register_oracle(env: soroban_sdk::Env, oracle: soroban_sdk::Address)

Swap tokens from source trust to destination trust Uses rate-adjusted calculation to account for different demurrage rates

fn cross_trust_swap(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    dest_trust: soroban_sdk::Address,
    amount: soroban_sdk::U256,
)

Get grace period details for an account

fn get_grace_period(
    env: soroban_sdk::Env,
    account: soroban_sdk::Address,
) -> Option

Process a proposal and update its status Transitions from Review to Voting, or Voting to Approved/Rejected

fn process_proposal(env: soroban_sdk::Env, proposal_id: u64)

Vote on a governance proposal Only trust members can vote on trust-specific proposals Admin can vote on protocol proposals

fn vote_on_proposal(
    env: soroban_sdk::Env,
    voter: soroban_sdk::Address,
    proposal_id: u64,
    support: bool,
)

Get the trust ID for an account

fn get_account_trust(
    env: soroban_sdk::Env,
    account: soroban_sdk::Address,
) -> Option

Get all proposals

fn get_all_proposals(env: soroban_sdk::Env) -> soroban_sdk::Vec

Register as a verifier for a trust Must stake 100 KCHNG to become a verifier

fn register_verifier(
    env: soroban_sdk::Env,
    verifier: soroban_sdk::Address,
    trust_id: soroban_sdk::Address,
)

Reject a work claim (verifier only)

fn reject_work_claim(
    env: soroban_sdk::Env,
    verifier: soroban_sdk::Address,
    claim_id: u64,
)

Submit a work claim for verification Returns the claim ID

fn submit_work_claim(
    env: soroban_sdk::Env,
    worker: soroban_sdk::Address,
    work_type: WorkType,
    minutes_worked: u64,
    evidence_hash: soroban_sdk::Bytes,
    gps_lat: Option,
    gps_lon: Option,
) -> u64

Unregister as an oracle and return stake If reputation is below 100 (removal threshold), 50% of stake is slashed If reputation is below 200 (restricted), 25% of stake is slashed

fn unregister_oracle(env: soroban_sdk::Env, oracle: soroban_sdk::Address)

Update a role-based score for a verifier

Role-based reputation allows for context-specific scoring. Hierarchy: Domain → Aspect → Role

For example:

  • Domain: Hospitality
  • Aspect: Dining
  • Role: Guest (score: 850)
  • Role: Host (score: 400)

This allows someone to have high reputation as a dinner guest but low reputation as a dinner host.

Arguments

  • verifier - The verifier whose role score is being updated
  • role_key - Compound key "aspect:role" (e.g., "dining:guest", "ride_sharing:driver")
  • delta - The change to apply (positive or negative, e.g., +30, -50)
  • scorer - The account submitting this score update (must authenticate)

Behavior

  • If role doesn't exist, initializes to 500 (neutral) then applies delta
  • Caps final score at [0, 1000]
  • Requires auth from scorer
fn update_role_score(
    env: soroban_sdk::Env,
    verifier: soroban_sdk::Address,
    role_key: soroban_sdk::Bytes,
    delta: i32,
    scorer: soroban_sdk::Address,
)

Approve a work claim (verifier only)

fn approve_work_claim(
    env: soroban_sdk::Env,
    verifier: soroban_sdk::Address,
    claim_id: u64,
)

Implement an approved proposal Can only be called after implementation date has passed

fn implement_proposal(env: soroban_sdk::Env, proposal_id: u64)

Check if an account is currently in a grace period

fn is_in_grace_period(env: soroban_sdk::Env, account: soroban_sdk::Address) -> bool

Extend an existing grace period (requires community voting)

fn extend_grace_period(
    env: soroban_sdk::Env,
    account: soroban_sdk::Address,
    additional_days: u64,
)

Get all reputation scores for an address

fn get_all_reputations(
    env: soroban_sdk::Env,
    address: soroban_sdk::Address,
) -> soroban_sdk::Map

Get full reputation data for a role (public)

fn get_reputation_data(
    env: soroban_sdk::Env,
    address: soroban_sdk::Address,
    role: RoleType,
) -> ReputationData

Unregister as a verifier and return stake If reputation is below 200, 10% of stake is slashed

fn unregister_verifier(env: soroban_sdk::Env, verifier: soroban_sdk::Address)

Activate a grace period for an account Parameters:

  • oracle: Address of the oracle activating the grace period
  • account: Account to activate grace period for
  • grace_type: Type of grace period
  • duration_days: Length of grace period
fn activate_grace_period(
    env: soroban_sdk::Env,
    oracle: soroban_sdk::Address,
    account: soroban_sdk::Address,
    grace_type: GraceType,
    duration_days: u64,
)

Check if verifier can verify in multiple trusts (high reputation)

fn can_multi_trust_verify(env: soroban_sdk::Env, address: soroban_sdk::Address) -> bool

Calculate exchange rate between two trusts Returns the multiplier for converting from source to destination trust Formula: (1 - r_source) / (1 - r_dest) Example: Trust A (12%) → Trust B (8%) = (1 - 0.12) / (1 - 0.08) = 0.957

fn calculate_exchange_rate(
    env: soroban_sdk::Env,
    source_trust: soroban_sdk::Address,
    dest_trust: soroban_sdk::Address,
) -> u64

Simulate a cross-trust swap without executing it Returns the amount that would be received in the destination trust

fn simulate_cross_trust_swap(
    env: soroban_sdk::Env,
    source_trust: soroban_sdk::Address,
    dest_trust: soroban_sdk::Address,
    amount: soroban_sdk::U256,
) -> soroban_sdk::U256

Get the effective demurrage rate for an account

fn get_account_demurrage_rate(
    env: soroban_sdk::Env,
    account: soroban_sdk::Address,
) -> (u32, u64)

Get pending claims for a verifier

fn get_verifier_pending_claims(
    env: soroban_sdk::Env,
    verifier: soroban_sdk::Address,
) -> soroban_sdk::Vec

Imports

WebAssembly Text (WAT) ▶