Contract 041e8895c77675c2a0fce4d0d78349993e084112ba5445f44aa8831599623c06

← Back to Index 📥 Download WASM

Meta

cliver 27.0.0#5a7c5fe76530bf4248477ac812fc757146b98cc4
rssdkver 26.1.0#175aa41306f383057a8cdfc84b68d931664fc34e
rsver 1.96.0

Instances

  • CALFJK7DTYB4ACZP7IIJS2FOA3VCJUJC5XRZ7HFBPSJ3S7ZN34Z2UZ5E

Interface

Join the circle (before it starts), posting collateral.

fn join(
    env: soroban_sdk::Env,
    member: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Leave a circle that hasn't started yet, taking the collateral back. Nothing is at stake before the first round, so this is unconditional — members are never locked in by an admin who doesn't press start.

fn leave(
    env: soroban_sdk::Env,
    member: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Admin slashes a member who didn't contribute this round: their collateral covers the missed contribution and their reputation drops.

fn slash(
    env: soroban_sdk::Env,
    member: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Lock membership and begin round 1. Admin only.

fn start(env: soroban_sdk::Env) -> Result<(), soroban_sdk::Error>

Wind the circle down and release everyone's collateral.

The admin may do this at any time before the circle finishes. Anyone may do it once the current round has stalled past round_timeout_ledgers — so an absent admin, or a defaulter whose collateral is spent and who can therefore no longer be slashed, can never strand the members' funds.

The current round is unwound: it never paid out, so contributions (including those covered by a slash) go back to the contributors' collateral balances, ready to withdraw.

fn cancel(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
fn get_pot(env: soroban_sdk::Env) -> i128
fn get_round(env: soroban_sdk::Env) -> u32

Contribute the fixed amount for the current round. Rewards reputation.

fn contribute(
    env: soroban_sdk::Env,
    member: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
fn get_config(env: soroban_sdk::Env) -> Result

Create the circle. Called once (by the admin, or by the Factory on the admin's behalf).

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    token: soroban_sdk::Address,
    reputation: soroban_sdk::Address,
    contribution_amount: i128,
    collateral_amount: i128,
    max_members: u32,
    round_timeout_ledgers: u32,
) -> Result<(), soroban_sdk::Error>

Whether anyone (not just the admin) may now cancel this circle.

fn is_stalled(env: soroban_sdk::Env) -> Result
fn get_members(env: soroban_sdk::Env) -> soroban_sdk::Vec

The current round's recipient claims the pot, rotating to the next round.

fn claim_payout(env: soroban_sdk::Env) -> Result<(), soroban_sdk::Error>

The member who receives the pot in the given round.

fn get_recipient(
    env: soroban_sdk::Env,
    round: u32,
) -> Result

Collateral still held for a member (posted on join, reduced by slashes).

fn get_collateral(env: soroban_sdk::Env, member: soroban_sdk::Address) -> i128
fn has_contributed(
    env: soroban_sdk::Env,
    round: u32,
    member: soroban_sdk::Address,
) -> bool

Take back whatever collateral is left once the circle has come to rest.

fn withdraw_collateral(
    env: soroban_sdk::Env,
    member: soroban_sdk::Address,
) -> Result

Ledger at which the current round began, once the circle has started.

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

Imports

WebAssembly Text (WAT) ▶