QA Report #337
Labels
bug
Something isn't working
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Table of Contents:
_safeMint()
should be used rather than_mint()
wherever possibleBaseRewardPool:donate()
CEIP not respectedAuraBalRewardPool:getReward()
CEIP not respected[L-01] Deprecated safeApprove() function
Using this deprecated function can lead to unintended reverts and potentially the locking of funds. A deeper discussion on the deprecation of this function is in OZ issue #2219 (OpenZeppelin/openzeppelin-contracts#2219). The OpenZeppelin ERC20 safeApprove() function has been deprecated, as seen in the comments of the OpenZeppelin code.
As recommended by the OpenZeppelin comment, I suggest replacing safeApprove() with safeIncreaseAllowance() or safeDecreaseAllowance() instead:
[L-02] Deprecated approve() function
While
safeApprove()
in itself is deprecated, it is still better thanapprove
which is subject to a known front-running attack. Consider usingsafeApprove
instead (or better:safeIncreaseAllowance()
/safeDecreaseAllowance()
):[L-03] Missing address(0) checks
In the constructors, the solution never checks for
address(0)
when setting the value of immutable variables. I suggest adding those checks.List of immutable variables:
[L-04] Unbounded loop on array can lead to DoS
As this array can grow quite large, the transaction's gas cost could exceed the block gas limit and make it impossible to call this function at all.
Consider introducing a reasonable upper limit based on block gas limits and adding a method to remove elements in the array.
[L-05] Add a timelock and event to critical functions
It is a good practice to give time for users to react and adjust to critical changes. A timelock provides more guarantees and reduces the level of trust required, thus decreasing risk for users. It also indicates that the project is legitimate (less risk of a malicious owner making a sandwich attack on a user).
Consider adding a timelock to:
Consider adding a timelock and event to:
[L-06] Failed transfer with low level call could be overlooked
Low-level calls return true even if the account called is non-existent (per EVM design). Account existence must be checked prior to calling.
Affected code:
Consider checking for account-existence before the
call()
to make this safely extendable to user-controlled address contexts in future. At the very least, check for address(0).[L-07]
_safeMint()
should be used rather than_mint()
wherever possible_mint()
is discouraged in favor of_safeMint()
which ensures that the recipient is either an EOA or implementsIERC721Receiver
. Both open OpenZeppelin and solmate have versions of this function so that NFTs aren't lost if they're minted to contracts that cannot transfer them back out.File: contracts/NFTLoanTicket.sol (line 34)
[L-08]
BaseRewardPool:donate()
CEIP not respectedCheck Effects Interactions pattern should always be respected, be it for the current state of the solution, the future of the solution or a future fork of the solution:
[L-09]
AuraBalRewardPool:getReward()
CEIP not respectedCheck Effects Interactions pattern should always be respected, be it for the current state of the solution, the future of the solution or a future fork of the solution:
[N-01] Using simple quotes for strings
To be consistent with the style used in the solution, consider using double quotes instead of simple quotes here:
[N-02] Unused named returns
Using both named returns and a return statement isn't necessary. Removing one of those can improve code clarity:
[N-03] Deprecated library used for Solidity 0.8.+ : SafeMath
Affected code:
[N-04] It's better to emit after all processing is done
Affected code:
[N-05] CEI not respected with a call made to the contract's address
Affected code:
The text was updated successfully, but these errors were encountered: