Platform: Code4rena
Start Date: 18/04/2024
Pot Size: $36,500 USDC
Total HM: 19
Participants: 183
Period: 7 days
Judge: Koolex
Id: 367
League: ETH
Rank: 75/183
Findings: 1
Award: $50.72
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: Bauchibred
Also found by: Al-Qa-qa, K42, SBSecurity, Sathish9098, VAD37, ZanyBonzy, albahaca, clara, niloy, oakcobalt, sxima
50.721 USDC - $50.72
4naly3er
report.KerosineDenominator: Low Severity:
denominator
function lacks specific input validation for the MAINNET_OWNER
address. Consider adding a check to ensure it is not the zero address.
Solution: Add a require
statement to check if MAINNET_OWNER
is not the zero address.Non-Critical:
denominator
function can be better simplified by directly returning the result of the subtraction.
Solution: Modify the function to return kerosine.totalSupply() - kerosine.balanceOf(MAINNET_OWNER);
.VaultManagerV2: Low Severity:
add
and addKerosene
functions also lack input validation for the vault
parameter. Consider adding a check to ensure it is not the zero address and is a contract address.
Solution: Add a require statement to check if vault
is not the zero address and is a contract address using address(vault).code.length > 0
.remove
and removeKerosene
functions allow removing a vault even if it has assets. This may eventually lead to unexpected behaviour or loss of funds.
Solution: Consider adding a specific check to prevent removing a vault if it still holds assets.deposit
function does not check if the vault
is a valid vault address.
Solution: Add a specific check to ensure that the vault
is a valid vault address before performing the deposit.Non-Critical:
DepositedInSameBlock
error is not defined in the contract. Define the error to improve clarity and consistency.
Solution: Define the DepositedInSameBlock
error in the contract.Initializable
contract is imported but not used. Remove the unused import to improve code readability.
Solution: Remove the unused import statement for Initializable
.idToBlockOfLastDeposit
mapping is not used in the deposit
function.
Solution: Consider removing the idToBlockOfLastDeposit
mapping if it is not needed.KerosineManager: Low Severity:
add
function also lacks input validation for the vault
parameter. Consider adding a check to ensure it is not the zero address and is a contract address.
Solution: Add a require statement to check if vault
is not the zero address and is a contract address using address(vault).code.length > 0
.Non-Critical:
VaultAlreadyAdded
error message is not descriptive enough. Consider providing more information about the vault that was already added.
Solution: Update the error message to include the address of the vault that was already added.remove
function does not emit an event when a vault is removed.
Solution: Consider emitting an event when a vault is successfully removed to improve transparency.BoundedKerosineVault: Low Severity:
assetPrice
function relies on the unboundedKerosineVault
contract, which may not be set or could be changed unexpectedly. Consider adding specific checks to ensure the contract is properly initialized and immutable.
Solution: Add a require statement to check if unboundedKerosineVault
is properly initialized and consider making it immutable.setUnboundedKerosineVault
function allows setting the unboundedKerosineVault
to the zero address.
Solution: Add a check to ensure that the _unboundedKerosineVault
address is not the zero address.Non-Critical:
NotWithdrawable
error is not used consistently in the contract.
Solution: Consider removing the NotWithdrawable
error if it is not needed or use it consistently.UnboundedKerosineVault: Low Severity:
assetPrice
function iterates over an unbounded array of vaults, which may lead to high gas consumption or potential denial of service if the number of vaults grows large.
Solution: Consider implementing pagination or limiting the number of vaults processed in a single call to mitigate the risk.setDenominator
function allows setting the kerosineDenominator
to the zero address.
Solution: Add a check to ensure that the _kerosineDenominator
address is not the zero address.Non-Critical:
assetPrice
function lacks proper error handling for cases where the denominator
is zero. Consider adding a check to prevent division by zero.
Solution: Add a require statement to check if the denominator
is not zero before performing the division.#0 - c4-pre-sort
2024-04-28T09:57:28Z
JustDravee marked the issue as high quality report
#1 - c4-judge
2024-05-05T17:06:17Z
koolexcrypto marked the issue as grade-b