Vote on a proposal by escrowing sXLM for the length of the vote.
Weight is the amount escrowed, so the same shares cannot vote twice or
be sold in the same ledger they voted in. Returned by unlock_vote once
voting closes.
fn vote(
env: soroban_sdk::Env,
voter: soroban_sdk::Address,
proposal_id: u64,
support: bool,
amount: i128,
)
Upgrade the contract WASM. Only callable by admin.
fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
Read the last approved value for a parameter.
This is a record, not the source of truth — execution applies the value to the target contract, and that contract is what to read for the live setting.
fn get_param(env: soroban_sdk::Env, key: soroban_sdk::Symbol) -> i128
Initialize the governance contract.
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
sxlm_token: soroban_sdk::Address,
voting_period_ledgers: u32,
quorum_bps: u32,
execution_delay_ledgers: u32,
)
Reclaim escrowed sXLM once voting on a proposal has closed.
fn unlock_vote(env: soroban_sdk::Env, voter: soroban_sdk::Address, proposal_id: u64)
fn get_proposal(env: soroban_sdk::Env, id: u64) -> Proposal
Earliest ledger at which a proposal may execute.
fn proposal_eta(env: soroban_sdk::Env, id: u64) -> u32
Bump instance TTL — can be called by anyone to keep contract alive.
fn bump_instance(env: soroban_sdk::Env)
fn get_vote_count(env: soroban_sdk::Env, id: u64) -> (i128, i128)
fn proposal_count(env: soroban_sdk::Env) -> u64
Create a new governance proposal. Proposer must hold minimum sXLM balance.
fn create_proposal(
env: soroban_sdk::Env,
proposer: soroban_sdk::Address,
target: soroban_sdk::Address,
param_key: soroban_sdk::Symbol,
new_value: i128,
) -> u64
Ledgers between voting closing and execution becoming possible.
fn execution_delay(env: soroban_sdk::Env) -> u32
sXLM a voter has escrowed on a proposal.
fn get_vote_weight(
env: soroban_sdk::Env,
proposal_id: u64,
voter: soroban_sdk::Address,
) -> i128
Execute a proposal if quorum met and passed. Stores the new parameter value on-chain for the admin/backend to read and propagate.
fn execute_proposal(env: soroban_sdk::Env, proposal_id: u64)