QA Report #17
Labels
bug
Something isn't working
disagree with severity
Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments)
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Low-impact Issues
Treasury fees are given to the lender on failure, rather than reverting
https://github.com/maple-labs/loan/blob/4c6fe2cd91d6d16b8434c426fe7eb6d2bc77bc30/contracts/MapleLoanInternals.sol#L321-L323
Inconsistent
approve()
behavior betweenERC20
andRevenueDistributionToken
RevenueDistributionToken
considers an approval value oftype(uint256).max
as 'allow all amounts':https://github.com/maple-labs/revenue-distribution-token/blob/41a3e40bf8c109ff19b38b80fde300c44fd42a3d/contracts/RevenueDistributionToken.sol#L279
whereas
ERC20
considers it as a numerical amount:https://github.com/maple-labs/erc20/blob/10ccf4aa0b2d6914e3c2d32e454e4d106a99a4fd/contracts/ERC20.sol#L110
These inconsistences will likely lead to confusion at some point in the future.
Incorrect revert string in
setEndingPrincipal()
https://github.com/maple-labs/loan/blob/4c6fe2cd91d6d16b8434c426fe7eb6d2bc77bc30/contracts/Refinancer.sol#L43
It should be
"R:SEP:ABOVE_CURRENT_PRINCIPAL"
.IERC20 should be named IERC20Permit
There may be cases in the future where you may not want EIP-2612 functionality due to deployment costs, and having the name
IERC20
taken will cause problemsIERC20 incorrectly includes
PERMIT_TYPEHASH
PERMIT_TYPEHASH
is not part of the requirements for EIP-2612, so it shouldn't appear in the interface.https://github.com/maple-labs/erc20/blob/10ccf4aa0b2d6914e3c2d32e454e4d106a99a4fd/contracts/interfaces/IERC20.sol#L134-L138
OpenZeppelin has it as a
private
constant
: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/52eeebecda140ebaf4ec8752ed119d8288287fac/contracts/token/ERC20/extensions/draft-ERC20Permit.sol#L28Missing checks for
address(0x0)
when assigning values toaddress
state variablespendingOwner = pendingOwner_;
Open TODOs
There are many open TODOs throughout the various test files, but also some among the code files
Incorrect Natspec
https://github.com/maple-labs/erc20/blob/10ccf4aa0b2d6914e3c2d32e454e4d106a99a4fd/contracts/interfaces/IERC20.sol#L12
The natspec doesn't mention that the event is also emitted when
transferFrom()
is called, even though the natspec fortransferFrom()
explicitly mentions it.Non-critical Issues
_processEstablishmentFees()
should emit events when fee processing failshttps://github.com/maple-labs/loan/blob/4c6fe2cd91d6d16b8434c426fe7eb6d2bc77bc30/contracts/MapleLoanInternals.sol#L316-L324
Multiple
address
mappings can be combined into a singlemapping
of anaddress
to astruct
, where appropriateUse scientific notation (e.g.
10e18
) rather than exponentiation (e.g.10**18
)public
functions not called by the contract should be declaredexternal
insteadContracts are allowed to override their parents' functions and change the visibility from
external
topublic
.Use a more recent version of solidity
Use a solidity version of at least 0.8.12 to get
string.concat()
to be used instead ofabi.encodePacked(<str>,<str>)
Typos
owner
=>owner_
https://github.com/maple-labs/erc20/blob/10ccf4aa0b2d6914e3c2d32e454e4d106a99a4fd/contracts/interfaces/IERC20.sol#L129
https://github.com/maple-labs/erc20/blob/10ccf4aa0b2d6914e3c2d32e454e4d106a99a4fd/contracts/interfaces/IERC20.sol#L132
https://github.com/maple-labs/mpl-migration/blob/a99549d96ed12cd4589a02bccf70747dbaebeb5b/contracts/Migrator.sol#L24
https://github.com/maple-labs/mpl-migration/blob/a99549d96ed12cd4589a02bccf70747dbaebeb5b/contracts/Migrator.sol#L26
https://github.com/maple-labs/mpl-migration/blob/a99549d96ed12cd4589a02bccf70747dbaebeb5b/contracts/Migrator.sol#L27
https://github.com/maple-labs/loan/blob/4c6fe2cd91d6d16b8434c426fe7eb6d2bc77bc30/contracts/interfaces/IOwnable.sol#L17
account
=>account_
https://github.com/maple-labs/loan/blob/4c6fe2cd91d6d16b8434c426fe7eb6d2bc77bc30/contracts/interfaces/IOwnable.sol#L11
Emits an event
=>Emitted when
https://github.com/maple-labs/erc20/blob/10ccf4aa0b2d6914e3c2d32e454e4d106a99a4fd/contracts/interfaces/IERC20.sol#L12
https://github.com/maple-labs/erc20/blob/10ccf4aa0b2d6914e3c2d32e454e4d106a99a4fd/contracts/interfaces/IERC20.sol#L20
ERC-2612
=>EIP-2612
https://github.com/maple-labs/erc20/blob/10ccf4aa0b2d6914e3c2d32e454e4d106a99a4fd/contracts/interfaces/IERC20.sol#L4
Grammar
Throughout the various interfaces, most of the comments have fragments that end with periods. They should either be converted to actual sentences with both a noun phrase and a verb phrase, or the periods should be removed.
The text was updated successfully, but these errors were encountered: