The NatSpec documentation for the getDepositAmount
function in the OfferLibraries
library contains inaccuracies related to the parameters and their descriptions. These discrepancies can lead to confusion about the function's behavior, particularly regarding the role of the _isMaker
parameter in bid and ask offers.
The getDepositAmount
function’s NatSpec documentation is inconsistent with the actual function logic.
Documentation Errors: The NatSpec comments indicate:
if create ask offer, return _amount * _collateralRate
if create bid offer, return _amount
if create ask order, return _amount
if create bid order, return _amount * _collateralRate
However, the function’s behavior is as follows:
For Bid offers, if _isMaker
is true, it returns _amount
.
For Ask orders, if _isMaker
is false, it returns _amount
.
In other cases, it calculates and returns _amount * _collateralRate
.
Misleading Documentation: The documentation inaccurately describes _isMaker
as related to whether the entity is creating an offer or an order, while it actually determines whether the function is processing a "maker" offer (true) or a "taker" offer (false).
Inaccurate documentation can mislead developers about how the function calculates deposit amounts, potentially leading to errors in understanding and implementing deposit logic. This can affect how deposits are handled for bid and ask offers, causing incorrect calculations or unintended behaviors.
Manual Code Review
Consider updating the NatSpec documentation to accurately reflect the function's behavior.
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.