Contract 73a8013c0bfbd5e759fce70b36fa2e43684607a6a76a9d86688e74237209d059

← Back to Index 📥 Download WASM

Meta

rssdkver 25.3.0#dcbea44513feb7734af6b6c4aced2c4a7a2715d0
rsver 1.94.0

Instances

  • CCGG5P7HU4TQNYOW6DK37JIDPZCAQ5ECBDENHEOULG72BZCD4BR7MKX6

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 the admin address

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

Voluntarily step down from a role (sociocratic role release) For governors: transfers to successor if designated, otherwise disables trust For verifiers/oracles: returns full stake (no slashing for voluntary release)

fn step_down(env: soroban_sdk::Env, address: soroban_sdk::Address, role: RoleType)

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 election details

fn get_election(env: soroban_sdk::Env, election_id: u64) -> VerifierElection

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

Migrate data from an old contract after an upgrade.

During Soroban contract upgrades, instance storage is cleared while persistent storage survives. This function restores instance storage from the old contract and validates that persistent data is intact.

Arguments

  • admin - The admin address (must match the source contract's admin)
  • source_contract - Address of the old contract to migrate from
  • expected_protocol_version - Expected version of the source contract

Returns

  • MigrationResult - Details about the migration including validation counts

Panics

  • If caller is not the admin
  • If migration was already completed
  • If source protocol version doesn't match expected
fn migrate_data(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    source_contract: soroban_sdk::Address,
    expected_protocol_version: u32,
) -> MigrationResult

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 genesis pool data

fn get_genesis_pool(env: soroban_sdk::Env) -> GenesisPoolData

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

Get the next claim ID

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

Get verifier fund data for a trust

fn get_verifier_fund(
    env: soroban_sdk::Env,
    trust_id: soroban_sdk::Address,
) -> VerifierFundData

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

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

Join the genesis trust (open to all, no governor stake required) This is the bootstrap entry point for new users

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

Report grace period abuse Called by an oracle when a member violates grace period conditions (e.g., claims illness but is seen working elsewhere) Penalizes the abuser and ends their grace period early

fn report_grace_abuse(
    env: soroban_sdk::Env,
    reporter: soroban_sdk::Address,
    account: soroban_sdk::Address,
    reason: soroban_sdk::String,
)

Designate a successor for the governor role (sociocratic succession) Only the current governor can call this The successor must be a member of the trust

fn designate_successor(
    env: soroban_sdk::Env,
    governor: soroban_sdk::Address,
    successor: soroban_sdk::Address,
)

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

Get all active elections for a trust

fn get_trust_elections(
    env: soroban_sdk::Env,
    trust_id: soroban_sdk::Address,
) -> soroban_sdk::Vec

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)

Get the genesis trust ID (contract address)

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

Get the migration status

fn get_migration_status(env: soroban_sdk::Env) -> Option

Get the next proposal ID

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

Get the protocol version

fn get_protocol_version(env: soroban_sdk::Env) -> u32

Get the total supply (raw U256)

fn get_total_supply_raw(env: soroban_sdk::Env) -> soroban_sdk::U256

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

Vote on a verifier election Only members of the same trust can vote

fn vote_verifier_election(
    env: soroban_sdk::Env,
    voter: soroban_sdk::Address,
    election_id: u64,
    support: 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

Propose oneself as a verifier for the community Creates an election that other members vote on The community's verifier fund covers the 100K stake

fn propose_verifier_election(
    env: soroban_sdk::Env,
    candidate: 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

Finalize a verifier election and register the verifier if approved

fn finalize_verifier_election(env: soroban_sdk::Env, election_id: u64)

Get the effective demurrage rate for an account

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

Claim compensation for verification work Base fee for any participation + 2% of claim value for approved claims

fn claim_verifier_compensation(
    env: soroban_sdk::Env,
    verifier: soroban_sdk::Address,
    claim_id: u64,
) -> VerifierCompensation

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