Skip to content

[Governance] Create proposal entrypoint #89

Description

@Kaylahray

Description

The Governance contract defines proposal storage and vote execution flows, but it still needs a public proposal-creation entrypoint so proposals can be created on-chain without test-only storage seeding.

User Story

As a Protocol User,
I want to create a proposal through the contract,
so that governance state begins from an on-chain action rather than direct storage writes.

Requirements and Context

  • Files: contracts/governance/src/lib.rs, contracts/governance/src/types.rs, contracts/governance/src/test.rs
  • Add create_proposal(env: Env, proposer: Address, metadata_hash: BytesN<32>, end_time: u64) -> u32
  • Require proposer.require_auth()
  • Generate and persist a new proposal ID with zeroed vote counters and executed = false
  • Add any additional storage key needed for proposal counting

Suggested Implementation

// IN FUNCTION: create_proposal(env: Env, proposer: Address, metadata_hash: BytesN<32>, end_time: u64) -> u32
// 1. proposer.require_auth();
// 2. let proposal_id = next stored counter value;
// 3. let proposal = Proposal { ... };
// 4. env.storage().persistent().set(&DataKey::Proposal(proposal_id), &proposal);
// 5. return proposal_id;

Acceptance Criteria

  • Proposals can be created without writing storage directly in tests.
  • Proposal IDs increment predictably.
  • Newly created proposals are voteable and executable through existing governance flows.

Submission Guidelines

  • Branch: feat/create-proposal
  • Depends on: [Governance] Define proposal schema
  • PR: feat(governance): add create_proposal entrypoint

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions