Entry proposal - #104
Merged
Merged
Conversation
- Add ProposalCount storage key variant to DataKey enum - Implement public create_proposal entrypoint requiring proposer authentication - Auto-increment proposal IDs and persist zeroed proposal initial state - Emit ProposalCreated event on successful creation - Add unit & integration tests for creation, ID incrementing, voting, and execution
Kaylahray
approved these changes
Jul 29, 2026
3 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
Adds the public
create_proposalentrypoint to the Governance contract so that proposal creation can occur on-chain without direct storage writes.Closes #89
Changes Included
contracts/governance/src/types.rs: AddedDataKey::ProposalCountfor tracking auto-incrementing proposal IDs.contracts/governance/src/lib.rs:ProposalCreatedevent schema.create_proposal(env: Env, proposer: Address, metadata_hash: BytesN<32>, end_time: u64) -> u32.proposer.require_auth().votes_for = 0,votes_against = 0,executed = false).contracts/governance/src/test.rs: Added unit and integration tests verifying proposal creation, predictable ID incrementing, event emission, and voting/execution workflows.Verification
test_create_proposal_successtest_create_proposal_increments_idtest_created_proposal_is_voteable_and_executabletest_create_proposal_emits_eventCloses: Governance public proposal creation entrypoint