Platform: Code4rena
Start Date: 29/03/2022
Pot Size: $30,000 USDC
Total HM: 6
Participants: 24
Period: 3 days
Judge: HardlyDifficult
Total Solo HM: 4
Id: 101
League: ETH
Rank: 16/24
Findings: 2
Award: $118.43
🌟 Selected for report: 0
🚀 Solo Findings: 0
82.2218 USDC - $82.22
PoolCreditLine.sol
LenderPool.sol
PoolCreditLine.constructor LenderPool.constructor LenderPool.create
Recommend implementing zero address check.
PooledCreditLine.getPrincipal
should be declared to externalLenderPool.start
might not be receivedIERC20(_borrowAsset).transfer(_to, _fee);
The unsafe transfer
function doesnt check the boolean return value to see if the fee has been received, leading to _fee
not being delivered.
Recommend implementing a check.
pragma solidity 0.7.6;
It's a best practice to use the latest compiler version.
Older compilers might be susceptible to some bugs. Recommend changing the solidity version pragma to the latest version to enforce the use of an up to date compiler.
List of known compiler bugs and their severity can be found here: https://etherscan.io/solcbuginfo
uint
gas efficiencyuint256
is more gas efficient than uint128
.
_updateProtocolFeeFraction
added layer of securityRecommend setting a limit to protocolFeeFraction
as an extra layer of security in case onlyOwner
gets compromised.
Example:
function _updateProtocolFeeFraction(uint256 _protocolFeeFraction) internal { require(_protocolFeeFraction <= SCALING_FACTOR, 'IUPFF1'); require(_protocolFeeFraction < ARBITRARY_NUMBER, 'IUPFF2'); protocolFeeFraction = _protocolFeeFraction; emit ProtocolFeeFractionUpdated(_protocolFeeFraction); }
#0 - ritik99
2022-04-12T21:50:47Z
All suggestions except switching to v0.8 are valid, see #67
36.2135 USDC - $36.21
Instead of:
function updatePriceOracle(address _priceOracle) external onlyOwner { require(priceOracle != _priceOracle, 'UPO1'); _updatePriceOracle(_priceOracle); } function _updatePriceOracle(address _priceOracle) internal { require(_priceOracle != address(0), 'IUPO1'); priceOracle = _priceOracle; emit PriceOracleUpdated(_priceOracle); }
It could be:
function updatePriceOracle(address _priceOracle) external onlyOwner { require(priceOracle != _priceOracle, 'UPO1'); require(_priceOracle != address(0), 'UPO2'); priceOracle = _priceOracle; emit PriceOracleUpdated(_priceOracle); }
It was not specified how the contract size was fixed in the next release, so this might or might not apply.
#0 - ritik99
2022-04-12T19:01:38Z
_updatePriceOracle
is called during initialization as well, during which we do not need to perform the extra check that updatePriceOracle
performs