Contract 9e329f20fb6e9a3473aebfaf01ce68c2df7c56607282f6092641db2d6bf0ef58

← Back to Index 📥 Download WASM

Meta

rssdkver 20.5.0#9e2c3022b4355b224a7a814e13ba51761eeb14bb
rsver 1.77.2

Interface

Initialize the governance contract.

fn initialize(env: soroban_sdk::Env, admin: soroban_sdk::Address, current_round: u32)

Get the current active round.

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

Change the active round.

fn set_current_round(env: soroban_sdk::Env, round: u32)

Set multiple submissions.

fn set_submissions(
    env: soroban_sdk::Env,
    new_submissions: soroban_sdk::Vec,
)

Get submissions for the active round.

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

Set votes for a submission.

fn set_votes_for_submission(
    env: soroban_sdk::Env,
    submission_id: soroban_sdk::String,
    votes: soroban_sdk::Map,
) -> Result<(), VotingSystemError>

Get votes for the submission for a specific round.

fn get_votes_for_submission_round(
    env: soroban_sdk::Env,
    submission_id: soroban_sdk::String,
    round: u32,
) -> Result, VotingSystemError>

Get votes for the submission for the active round

fn get_votes_for_submission(
    env: soroban_sdk::Env,
    submission_id: soroban_sdk::String,
) -> Result, VotingSystemError>

Compute the final voting power of a submission.

Requires calling calculate_voting_powers first to compute and store voting powers for the round.

Panics:

The function will panic if no voting powers are set for the active round.

fn tally_submission(
    env: soroban_sdk::Env,
    submission_id: soroban_sdk::String,
) -> Result
fn transfer_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)
fn upgrade(env: soroban_sdk::Env, wasm_hash: soroban_sdk::BytesN<32>)
fn add_layer(
    env: soroban_sdk::Env,
    raw_neurons: soroban_sdk::Vec<(soroban_sdk::String, soroban_sdk::I256)>,
    layer_aggregator: LayerAggregator,
) -> Result<(), VotingSystemError>
fn remove_layer(
    env: soroban_sdk::Env,
    layer_id: soroban_sdk::String,
) -> Result<(), VotingSystemError>
fn update_layer(
    env: soroban_sdk::Env,
    layer_id: soroban_sdk::String,
    raw_neurons: soroban_sdk::Vec<(soroban_sdk::String, soroban_sdk::I256)>,
    layer_aggregator: LayerAggregator,
) -> Result<(), VotingSystemError>
fn get_layer(
    env: soroban_sdk::Env,
    layer_id: soroban_sdk::String,
) -> Result
fn get_neuron(
    env: soroban_sdk::Env,
    layer_id: soroban_sdk::String,
    neuron_id: soroban_sdk::String,
) -> Result
fn get_neuron_result_round(
    env: soroban_sdk::Env,
    layer_id: soroban_sdk::String,
    neuron_id: soroban_sdk::String,
    round: u32,
) -> Result<
    soroban_sdk::Map,
    VotingSystemError,
>
fn get_neuron_result(
    env: soroban_sdk::Env,
    layer_id: soroban_sdk::String,
    neuron_id: soroban_sdk::String,
) -> Result<
    soroban_sdk::Map,
    VotingSystemError,
>
fn set_neuron_result(
    env: soroban_sdk::Env,
    layer_id: soroban_sdk::String,
    neuron_id: soroban_sdk::String,
    result: soroban_sdk::Map,
)

Get a result of a whole layer

Gets a result of each neuron and aggregates them using a configured aggregator function

fn get_layer_result(
    env: soroban_sdk::Env,
    layer_id: soroban_sdk::String,
) -> Result<
    soroban_sdk::Map,
    VotingSystemError,
>
fn calculate_voting_powers(env: soroban_sdk::Env) -> Result<(), VotingSystemError>
fn get_voting_powers(
    env: soroban_sdk::Env,
) -> Result<
    soroban_sdk::Map,
    VotingSystemError,
>

Get a current neural governance setup

fn get_neural_governance(env: soroban_sdk::Env) -> Result

Imports

WebAssembly Text (WAT) ▶