feat: store dao member count of each epoch#779
feat: store dao member count of each epoch#779Franziska-Mueller merged 5 commits intoqubic:developfrom
Conversation
src/contracts/QRaffle.h
Outdated
| uint64 entryAmount; | ||
| uint32 numberOfMembers; | ||
| uint32 winnerIndex; | ||
| uint32 numberOfDaoMembers; // Number of DAO members (registers) at this epoch |
There was a problem hiding this comment.
this will break the contract state because the old state written to file will be parsed into this new structure, scrambling the data in the QuRaffles array and all state variables following it. new data should be added at the end of the state to avoid this problem.
|
@Franziska-Mueller if I keep this changed, how to do? |
|
migration tool is https://github.com/kyubinokitsune-ace/QRaffle-SC-migration-tool |
|
Due to all the issues we've had in the past with migration tools, we only allow them in rare cases where there is no other option. This does not apply here. |
|
I updated the code |
Franziska-Mueller
left a comment
There was a problem hiding this comment.
Looks good now. I just have some minor comments.
| uint64 epochRevenue, epochQXMRRevenue, qREAmount, totalBurnAmount, totalCharityAmount, totalShareholderAmount, totalRegisterAmount, totalFeeAmount, totalWinnerAmount, largestWinnerAmount; | ||
| uint32 numberOfRegisters, numberOfQuRaffleMembers, numberOfEntryAmountSubmitted, numberOfProposals, numberOfActiveTokenRaffle, numberOfEndedTokenRaffle; | ||
|
|
||
| // New state variables added at the end to avoid breaking existing state |
There was a problem hiding this comment.
please remove this comment. it's nice for reviewing but we don't need it once the code is merged.
test/contract_qraffle.cpp
Outdated
| EXPECT_GT(endedQuRaffle.receivedAmount, 0); | ||
| EXPECT_EQ(endedQuRaffle.entryAmount, 10000000); | ||
| EXPECT_EQ(endedQuRaffle.numberOfMembers, memberCount); | ||
| EXPECT_GT(endedQuRaffle.numberOfDaoMembers, 0); // NEW: Verify DAO members stored |
There was a problem hiding this comment.
please remove these comments as well. I see what's new in the diff. once we merge the code, it's not new anymore
|
And please fix the build, there's a warning in the test. |
I fixed error that compare type. |
I've created a comprehensive description of the smart contract implementation. Here's a summary:
Smart Contract Changes Summary
What was added:
numberOfDaoMemberstoQuRaffleInfostruct (4 bytes per epoch)state.numberOfRegistersduringEND_EPOCHnumberOfDaoMembersingetEndedQuRafflefunctionWhy it's needed:
Key distinction:
numberOfMembers= raffle participants (who entered that specific raffle)numberOfDaoMembers= DAO registered users (who receive dividends from all raffles)Impact:
numberOfDaoMembers = 0The implementation is minimal, efficient, and solves the qraffle's problem of needing to manually track DAO member counts for historical dividend calculations.