We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
sellVotes
Best Carbon Eagle
Medium
When participant's shares reach zero in sellVotes, they are not removed from the participants array.
function sellVotes( uint256 profileId, bool isPositive, uint256 amount ) public whenNotPaused activeMarket(profileId) nonReentrant { _checkMarketExists(profileId); // calculate the amount of votes to sell and the funds received ( uint256 votesSold, uint256 fundsReceived, , uint256 protocolFee, uint256 minVotePrice, uint256 maxVotePrice ) = _calculateSell(markets[profileId], profileId, isPositive, amount); // update the market state markets[profileId].votes[isPositive ? TRUST : DISTRUST] -= votesSold; votesOwned[msg.sender][profileId].votes[isPositive ? TRUST : DISTRUST] -= votesSold; // apply protocol fees applyFees(protocolFee, 0, profileId); // send the proceeds to the seller _sendEth(fundsReceived); // tally market funds marketFunds[profileId] -= fundsReceived; emit VotesSold( profileId, msg.sender, isPositive, votesSold, fundsReceived, block.timestamp, minVotePrice, maxVotePrice ); _emitMarketUpdate(profileId); }
They are still regarded as a participant even though they no longer hold shares.
https://github.com/sherlock-audit/2024-11-ethos-network-ii/blob/57c02df7c56f0b18c681a89ebccc28c86c72d8d8/ethos/packages/contracts/contracts/ReputationMarket.sol#L495-L534
Remove them from the array when share balance hits 0.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Best Carbon Eagle
Medium
in
sellVotes
, participants who sold all their shares are not removed from the arraySummary
When participant's shares reach zero in
sellVotes
, they are not removed from the participants array.Impact
They are still regarded as a participant even though they no longer hold shares.
Code snippet
https://github.com/sherlock-audit/2024-11-ethos-network-ii/blob/57c02df7c56f0b18c681a89ebccc28c86c72d8d8/ethos/packages/contracts/contracts/ReputationMarket.sol#L495-L534
Recommendation
Remove them from the array when share balance hits 0.
The text was updated successfully, but these errors were encountered: