Colossal Chiffon Urchin
Medium
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.
no slippage protection like in buyVotes
function sellVotes(
uint256 profileId,
bool isPositive,
uint256 amount
) public whenNotPaused activeMarket(profileId) nonReentrant {
No response
No response
No response
Users are exposed to price volatility without protection, which could lead to unexpected losses.
No response
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...
}