Platform: Code4rena
Start Date: 28/10/2021
Pot Size: $30,000 ETH
Total HM: 8
Participants: 19
Period: 3 days
Judge: leastwood
Total Solo HM: 4
Id: 47
League: ETH
Rank: 7/19
Findings: 3
Award: $1,771.30
π Selected for report: 4
π Solo Findings: 0
679.3693 USDC - $679.37
defsec
During the code review, It has been seen that oracle return value has not been checked on the function. If oracle is returned price as a 0, balance of shares will be zero.
Code Review
Consider to add return value check on the oracle function.
""" require(oracle.pricePerShare()>0, "Price should be more than zero"); """
#0 - 0xleastwood
2021-12-04T09:09:36Z
#90
91.7149 USDC - $91.71
defsec
The initialize function that initializes important contract state can be called by anyone.
None
Use the constructor to initialize non-proxied contracts. For initializing proxy contracts deploy contracts using a factory contract that immediately calls initialize after deployment or make sure to call it immediately after deployment and verify the transaction succeeded.
#0 - dapp-whisperer
2021-11-08T23:38:59Z
I philosophically agree with the approach
#1 - 0xleastwood
2021-12-04T09:00:42Z
#40
226.4564 USDC - $226.46
defsec
Since the _pendingGovernance parameter in the setPendingGovernance are used to add governance. In the state variable , proper check up should be done , other wise error in these state variable can lead to redeployment of contract.
Code Review
Add proper zero address validation.
π Selected for report: defsec
503.2365 USDC - $503.24
defsec
After pragma version, 0.7.0, the contract should use block.timestamp.
"https://github.com/code-423n4/2021-10-badgerdao/blob/main/contracts/WrappedIbbtcEth.sol#L74"
None
It is recommended to use block.timestamp instead of now.
44.0601 USDC - $44.06
defsec
Using newer compiler versions and the optimizer gives gas optimizations and additional safety checks are available for free.
The advantages of versions 0.8.* over <0.8.0 are:
(https://github.com/code-423n4/2021-10-badgerdao/blob/main/contracts/WrappedIbbtc.sol#L2 && ) (https://github.com/code-423n4/2021-10-badgerdao/blob/main/contracts/ICoreOracle.sol#L3) (https://github.com/code-423n4/2021-10-badgerdao/blob/main/contracts/ICore.sol#L3) (https://github.com/code-423n4/2021-10-badgerdao/blob/main/contracts/WrappedIbbtcEth.sol#L2)
None
Consider to upgrade pragma to at least 0.8.4.
226.4564 USDC - $226.46
defsec
On several locations in the code precautions are taken not to divide by 0, because this will revert the code. However on some locations this isnβt done.
Especially in the balanceToShares function div(pricePerShare) which isnβt checked.
That will cause to revert on the transfer and transferFrom function. Oracle pricePerShare variable should be cheked on the balance calculation.
Review
Recommend making sure division by 0 wonβt occur by checking the variables beforehand and handling this edge case.