Skip to content

Refactor Campaign Pool Constructor function #64 #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: pool_campaign
Choose a base branch
from

Conversation

FrankiePower
Copy link

Pull Request: Refactor Campaign Pool Constructor function


Context

This PR enhances the CampaignPools contract in the TokenGiver project by adding support for a governance token and voting periods. Specifically, it:

  1. Adds storage for the governance token contract address and tokens-per-donation rate in the constructor.
  2. Updates the CampaignPool struct to include voting start and end times.
    These changes enable tracking of governance token distribution for donations and voting periods for campaign pools, supporting decentralized decision-making for pool fund allocation on StarkNet. The modifications are submitted to the pool_campaign branch as requested.

Assumptions

  • CampaignPools Contract:

    • Manages campaign pools via create_campaign_pool and related functions.
    • The governance token address will be used later for minting tokens on donations (not implemented in this PR).
    • Voting periods (voting_start_time, voting_end_time) will be set and validated in future functions.
  • Storage Updates:

    • governance_token_address stores the address of an external governance token contract.
    • tokens_per_donation defines the rate of token minting per donation unit.
    • CampaignPool struct now includes voting_start_time and voting_end_time, initialized to 0.
  • Deployment:

    • Constructor accepts new parameters (governance_token_address, tokens_per_donation) during deployment.
    • No functional changes to existing logic—only structural additions.
  • Branch:

    • All changes are targeted for the pool_campaign branch.

Changes

  1. Storage Updates:

    • Added governance_token_address: ContractAddress to Storage.
    • Added tokens_per_donation: u256 to Storage.
  2. Constructor:

    • Updated to include governance_token_address and tokens_per_donation parameters.
    • Writes these values to storage during initialization.
  3. CampaignPool Struct:

    • Added voting_start_time: u64 and voting_end_time: u64 to the CampaignPool struct in create_campaign_pool, initialized to 0.

Acceptance Criteria

  1. Governance Token Support:

    • ✅ Constructor accepts and stores governance_token_address.
    • ✅ Constructor accepts and stores tokens_per_donation.
  2. Voting Period Support:

    • CampaignPool struct includes voting_start_time and voting_end_time.
    • ✅ Fields are initialized to 0 in create_campaign_pool.
  3. No Functional Changes:

    • ✅ Existing functionality remains unchanged.
    • ✅ Only structural additions made as per requirements.

Screenshot

On scarb build :

Screenshot from 2025-04-09 13-13-54


Checklist

  • Add governance_token_address to Storage.
  • Add tokens_per_donation to Storage.
  • Update constructor with new parameters and storage writes.
  • Add voting_start_time and voting_end_time to CampaignPool struct.
  • Ensure code follows Cairo/StarkNet standards.
  • Submit PR to pool_campaign branch.
  • Verify compilation with scarb build (pending screenshot).
  • Closes Refactor Campaign Pool Constructor function #64

@FrankiePower
Copy link
Author

@Oshioke-Salaki PR is ready to be reviewed and merged

@FrankiePower
Copy link
Author

@Oshioke-Salaki

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.

1 participant