Pieces Protocol

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

Buyer can only query the price of orders, but cannot query the amount of fraction token in each order

Description:

In the getOrderPrice function, the contract returns only the price of the order,
not the actual amount of tokens being sold. Logically, buyers should be able to query the amount of tokens in each order.

function getOrderPrice(address seller, uint256 index) public view returns(uint256 price) {
price = s_userToSellOrders[seller][index].price;
}

Impact:

non-transparent to buyers, they cannot know the actual amount of tokens they will get after buying an order.

Recommended Mitigation:

return the full struct of the order instead of only the price

- function getOrderPrice(address seller, uint256 index) public view returns(uint256 price) {
- price = s_userToSellOrders[seller][index].price;
- }
+ function getOrderPrice(address seller, uint256 index) public view returns(SellOrder memory) {
+ return s_userToSellOrders[seller][index];
+ }
Updates

Lead Judging Commences

fishy Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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