You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 20, 2022. It is now read-only.
I've been looking through your contract and wanted to add my $.02 regarding gas costs. I think you could save a lot of gas if you store only the hashes of the vote instead of the full vote.
e.g.
// maps a voteID to the vote struct
mapping(uint256 => KNWVote) public votes;
becomes
// maps a voteID to keccak256(KNWParams)
mapping(uint256 => bytes32) public votes;
With Params being the start parameters that are generated at startVote.
Now Users have to provide the Parameters every time they vote, the vote than gets hashed and compared to votes[_voteID]. Since storing is so expensive (SStore 20000 gas) we can save a lot of gas (provided < 1000 votes on a proposal (very rough numbers))