Get a user's vote record for a round (None if not voted).
fn get_vote(
env: soroban_sdk::Env,
voter: soroban_sdk::Address,
round_id: u32,
) -> Option
fn has_role(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
role: soroban_sdk::Symbol,
) -> Option
Cast a weighted vote directly — the voter signs this transaction.
Tier and weight are resolved via cross-contract call to the Reputation contract.
The vote weight applied
fn cast_vote(
env: soroban_sdk::Env,
voter: soroban_sdk::Address,
round_id: u32,
option_id: u32,
vote_type: VoteType,
) -> u32
fn get_admin(env: soroban_sdk::Env) -> Option
Get a governance round by ID.
fn get_round(env: soroban_sdk::Env, round_id: u32) -> Option
Add a redistribution option to an existing round.
Requires the "admin" role.
The newly assigned option_id
fn add_option(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
round_id: u32,
title: soroban_sdk::String,
) -> u32
Get the admin role symbol.
fn admin_role(env: soroban_sdk::Env) -> soroban_sdk::Symbol
Get a governance option by round and option ID.
fn get_option(
env: soroban_sdk::Env,
round_id: u32,
option_id: u32,
) -> Option
fn grant_role(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
role: soroban_sdk::Symbol,
caller: soroban_sdk::Address,
)
Close a round and compute the winner.
Requires the "admin" role.
Can only be called once end_ledger has been reached.
Winning option ID (None if no upvotes were cast)
fn close_round(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
round_id: u32,
) -> Option
Record a vote on behalf of a voter via the trusted recorder service.
Requires the "recorder" role.
This is the primary API integration path. Eligibility and tier are verified
off-chain; the supplied tier is the authoritative vote weight source.
caller - Recorder address (must have recorder role)voter - Address of the voterround_id - Active governance round IDoption_id - Option to vote forvote_type - Up or Downtier - Voter's NFT tier (verified off-chain by the API)The vote weight applied
fn record_vote(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
voter: soroban_sdk::Address,
round_id: u32,
option_id: u32,
vote_type: VoteType,
tier: NftTier,
) -> u32
fn revoke_role(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
role: soroban_sdk::Symbol,
caller: soroban_sdk::Address,
)
Create a new governance round.
Requires the "admin" role.
caller - Admin addresstitle - Human-readable round titlestart_ledger - Ledger sequence when voting opensend_ledger - Ledger sequence when voting closesfund_amount - Community fund at stake in stroops (0 if unset)The newly assigned round_id
fn create_round(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
title: soroban_sdk::String,
start_ledger: u32,
end_ledger: u32,
fund_amount: i128,
) -> u32
Initialize the Governance contract.
admin - Address with admin privilegesreputation_contract - Address of the Reputation contract (for tier lookup)Error::AlreadyInitialized - Contract was already initializedfn __constructor(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
reputation_contract: soroban_sdk::Address,
)
Get the recorder role symbol.
fn recorder_role(env: soroban_sdk::Env) -> soroban_sdk::Symbol
fn renounce_role(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
caller: soroban_sdk::Address,
)
fn get_role_admin(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
) -> Option
Query a voter's NFT tier from the Reputation contract.
fn get_voter_tier(
env: soroban_sdk::Env,
voter: soroban_sdk::Address,
) -> Option
fn renounce_admin(env: soroban_sdk::Env)
fn set_role_admin(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
admin_role: soroban_sdk::Symbol,
)
fn get_role_member(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
index: u32,
) -> soroban_sdk::Address
Get the total number of voters in a round.
fn get_voter_count(env: soroban_sdk::Env, round_id: u32) -> u32
Get the live status of a round (automatically computes from current ledger).
fn get_round_status(env: soroban_sdk::Env, round_id: u32) -> Option
Get the next round ID that would be assigned.
fn get_next_round_id(env: soroban_sdk::Env) -> u32
Get the next option ID that would be assigned for a round.
fn get_next_option_id(env: soroban_sdk::Env, round_id: u32) -> u32
fn transfer_admin_role(
env: soroban_sdk::Env,
new_admin: soroban_sdk::Address,
live_until_ledger: u32,
)
fn accept_admin_transfer(env: soroban_sdk::Env)
fn get_role_member_count(env: soroban_sdk::Env, role: soroban_sdk::Symbol) -> u32
Get the configured Reputation contract address.
fn get_reputation_contract(env: soroban_sdk::Env) -> Option
Update the Reputation contract address.
Only the contract admin can call this.
fn set_reputation_contract(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
reputation_contract: soroban_sdk::Address,
)