cidFee is 0 for some values and second transfer of fee amount will be a little bigger than it should.
Vulnerability Detail
CID_FEE_BPS is a constant with value 1_000
if subprotocolFee > 0 and subprotocolFee < 10, when calculating cifFee, result will be 0 due to solidity rounding.
Lines of code
https://github.com/code-423n4/2023-01-canto-identity/blob/d7843c5d7ab731ba959cdb1389ba6bd5a2f5bbd3/src/CidNFT.sol#L189-L194
Vulnerability details
fee
s transferred affected atCidNFT#add()
Summary
cidFee
is 0 for some values and second transfer of fee amount will be a little bigger than it should.Vulnerability Detail
CID_FEE_BPS
is a constant with value1_000
ifsubprotocolFee > 0
andsubprotocolFee < 10
, when calculating cifFee, result will be 0 due to solidity rounding.This would affect following 2 transfers, making bigger the second transfer and 0 the first transfer
Impact
Different amounts of fee transferred to
cidFeeWallet
andsubprotocolOwner
than they shouldCode Snippet
Tool used
Manual Review
Recommendation
Revert with values in the range of:
subprotocolFee > 0
andsubprotocolFee < 10
or take into account rounding for the operation