Skip to content

Latest commit

 

History

History
63 lines (41 loc) · 1.51 KB

File metadata and controls

63 lines (41 loc) · 1.51 KB

Colossal Chiffon Urchin

Medium

Users are exposed to price volatility without protection in sellVotes

Summary

The sellVotes function does not include any slippage checks, unlike the buyVotes function. Users could receive significantly less ETH than expected due to price slippage during the transaction.

Root Cause

no slippage protection like in buyVotes

  function sellVotes(
    uint256 profileId,
    bool isPositive,
    uint256 amount
  ) public whenNotPaused activeMarket(profileId) nonReentrant {
 

ReputationMarket.sol#L495

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

No response

Impact

Users are exposed to price volatility without protection, which could lead to unexpected losses.

PoC

No response

Mitigation

Introduce slippage parameters to the sellVotes function, allowing users to specify the minimum acceptable funds to receive. This protects users from adverse price movements during the transaction.

function sellVotes(
    uint256 profileId,
    bool isPositive,
    uint256 amount,
    uint256 minExpectedFunds,
    uint256 slippageBasisPoints
) public whenNotPaused activeMarket(profileId) nonReentrant {
    // Existing code...

    // Slippage check
    _checkSlippageLimit(fundsReceived, minExpectedFunds, slippageBasisPoints);

    // Existing code...
}