Pieces Protocol

First Flight #32
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: high
Invalid

Price Manipulation in sellErc20

Summary

The contract allows sellers to set any price, which could lead to market manipulation by setting extremely low or high prices, potentially for sandwich attacks or other manipulative strategies.

Vulnerability Details

Impact

1. Market Manipulation: Sellers can set misleading prices to exploit other users or the market.
2. Loss of Trust: If users see wild price discrepancies, they might question the reliability of the platform.
3. Ecosystem Health: Such manipulations could destabilize the token economy around NFTs on the platform, deterring new users and reducing liquidity.

Tools Used

Manual Review

Recommendations

Implement price sanity checks using an oracle or historical data:
Code Snippet:
```solidity
function sellErc20(address nftPegged, uint256 price, uint256 amount) external {
// ... existing checks ...
require(price > getMinPrice(nftPegged) && price < getMaxPrice(nftPegged), "Price out of acceptable range");
// ... rest of the function ...
}
function getMinPrice(address nft) internal view returns (uint256) {
// Example logic, could be integrated with an oracle or historical data
return 1 ether; // Minimum price, for example
}
function getMaxPrice(address nft) internal view returns (uint256) {
// Example logic, could be integrated with an oracle or historical data
return 1000 ether; // Maximum price, for example
}
```
Updates

Lead Judging Commences

fishy Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.