The TokenDivider::buyOrder
function removes the sell order at orderIndex
and moves to its place(index) a sell order from the end of the s_userToSellOrders
array. This might confused a buyer who wants to buy order at index 0, but anoter buyer has already bought the order at index 0 and the first buyer will now buy an order he didn't intend to, buying a different nft from the one he wanted. Another problem is there is no way to get data about the sell order, only thing you can query is the price using TokenDivider:getOrderPrice
function. Buyers are left in the dark, they have no idea what they are even buying, what erc tokens to which nft.
Buyer buying a different nft from the one he wanted. This creates confusion for the buyers/users of the contract.
Proof of Concept:
USER mints 3 diffrent nfts and approves and divides them
USER creates sell orders for all 3 nfts
USER2 buys order at index 0, now the sell order at index 2 replaces the sell order at index 0
PoC Code
Add following test:
Manual review
To prevent this, don't manipulate the s_userToSellOrders
array in such a way, use unique identifiers for sell orders. Also add some more getters for the sell orders so it's easier for buyers to query what they might want to buy.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.