Skip to content

Entry proposal - #104

Merged
Kaylahray merged 2 commits into
learnault:mainfrom
SaintSammi:entry-proposal
Jul 29, 2026
Merged

Entry proposal#104
Kaylahray merged 2 commits into
learnault:mainfrom
SaintSammi:entry-proposal

Conversation

@SaintSammi

Copy link
Copy Markdown
Contributor

Summary

Adds the public create_proposal entrypoint 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: Added DataKey::ProposalCount for tracking auto-incrementing proposal IDs.
  • contracts/governance/src/lib.rs:
    • Added ProposalCreated event schema.
    • Implemented create_proposal(env: Env, proposer: Address, metadata_hash: BytesN<32>, end_time: u64) -> u32.
    • Enforced proposer.require_auth().
    • Persisted proposal data (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

  • Unit and integration tests cover:
    • test_create_proposal_success
    • test_create_proposal_increments_id
    • test_created_proposal_is_voteable_and_executable
    • test_create_proposal_emits_event

Closes: Governance public proposal creation entrypoint

- 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
Kaylahray merged commit fc5fc8e into learnault:main Jul 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Governance] Create proposal entrypoint

2 participants