feat(smart-contract): add agent governance and voting mechanism - #455
Merged
Conversation
|
@nasarajoe is attempting to deploy a commit to the Jaja's projects Team on Vercel. A member of the Team first needs to authorize it. |
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements an on-chain governance system where registered agents vote on
protocol changes, parameter updates, and agent disputes. Adds a new
agent_governanceSoroban contract crate.Closes #253
What's implemented
New crate:
smart-contracts/contracts/agent_governance/src/lib.rssrc/types.rssrc/errors.rs#[contracterror]codessrc/test.rssmart-contracts/Cargo.tomlgainscontracts/agent_governanceas aworkspace member.
Functionality
create_proposal— registered-agent–gated; three proposal types(
ParameterChange,AgentDispute,ProtocolUpgrade); configurablevoting period (default 7 days, bounded 1 h–30 days); snapshots the
electorate's total voting power into the proposal so quorum has a
stable denominator.
voting_power = stake + reputation * REPUTATION_POWER_UNIT. Tracked inaggregate across all registered agents and cached per agent.
register_agent/update_agent— agents join the electorate witha reputation score (
[0, 100]) and stake; aggregate power is kept insync on updates.
vote_on_proposal— optionsFor,Against,Abstain; one voteper agent, weighted by current voting power; rejects votes after the
deadline or on non-active proposals.
execute_proposal— callable by anyone after the deadline.snapshotted total voting power.
(For + Against; abstentions excluded). Zero decisive votes → fails.
ExecutedorFailedaccordingly.get_proposal,get_vote,get_agent,get_total_voting_power,get_proposal_count.Events
ProposalCreated,VoteCast,ProposalExecuted,ProposalFailed(plus
agent_reg/agent_upd), all under thegovtopic namespace.Testing
cargo test -p agent-governance— 23 passed, 0 failedcargo clippy -p agent-governance --all-targets— clean, no warningscargo fmtappliedAcceptance criteria
create_proposalfunction for governance proposalsvote_on_proposalwith options: For, Against, Abstain