Users might sell NFT or fractional tokens for 0 #409
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-243
satisfactory
satisfies C4 submission criteria; eligible for awards
Lines of code
https://github.com/code-423n4/2022-12-caviar/blob/0212f9dc3b6a418803dbfacda0e340e059b8aae2/src/Pair.sol#L406
Vulnerability details
Impact
Users might sell NFT or fractional tokens for 0 base token.
Proof of Concept
The return value of function Pair.sol#sellQuote may be 0.
This will result in the user calling
Pair.sol#sell
lose theinputAmount
of fractional tokens, because 0 base token will send to the user ifminOutputAmount = 0
.Tools Used
Manual
Recommended Mitigation Steps
I recommend to revert the
Pair.sol#sell
if outputAmount is 0The text was updated successfully, but these errors were encountered: