As we can see above, the entriesCount is calculated separately about individual tokenIds.
For example, we say that the price of token is 150, round.valuePerEntry == 100 and a user deposits two tokenIds. Then total value is 300 but it distributes only 2 entries.
This problem occurs in case of ERC20.
This is unfair to users. In fact, it is little possible that the price of ERC721 token is multiple of round.valuePerEntry. So it means that a user who deposits ERC721 always loses funds.
Impact
When a user deposits ERC721 token, he does not recieve correct count of entries corresponding to total value. This problem exists in case of ERC20.
dany.armstrong90
high
Distribution of entries to users is wrong.
Summary
When a user deposits several tokenIds of ERC721, it does not distribute entries corresponding to total value. This problem occurs in case of ERC20.
Vulnerability Detail
YoloV2.sol#_deposit()
function where a user deposits is as follows.As we can see above, the
entriesCount
is calculated separately about individual tokenIds. For example, we say that the price of token is 150,round.valuePerEntry == 100
and a user deposits two tokenIds. Then total value is 300 but it distributes only2 entries
. This problem occurs in case of ERC20.This is unfair to users. In fact, it is little possible that the price of
ERC721 token
is multiple ofround.valuePerEntry
. So it means that a user who deposits ERC721 always loses funds.Impact
When a user deposits ERC721 token, he does not recieve correct count of entries corresponding to total value. This problem exists in case of ERC20.
Code Snippet
https://github.com/sherlock-audit/2024-01-looksrare/blob/main/contracts-yolo/contracts/YoloV2.sol#L1102
Tool used
Manual Review
Recommendation
YoloV2.sol#_deposit
function has to be modified as follows.Duplicate of #11