After a line by line manual analysis and automated review, Guardian Audits has concluded that:
- Published
- Language
- Solidity
- Chains
- Fantom
- Sector
- Yield and vaults
- 0 Critical
- 0 High
- 0 Medium
- 8 Low
- 0 Informational
Scope
Overview
After a line by line manual analysis and automated review, Guardian Audits has concluded that:
- Beefy Finance’s smart contracts have a LOW RISK SEVERITY
- Beefy Finance’s smart contracts have an ACTIVE OWNERSHIP
- Important owner privileges –
panic,pause,deleverageOnce,rebalance,addRewardToNativeRoute,removeRewardToNativeRoute - Beefy Finance’s smart contract owner has multiple “write” privileges. Centralization risk correlated to the active ownership is LOW
Findings 8
-
STR-1 Low Centralization Risk Centralization / Privilege Resolved
Description
There are several avenues through which the contract’s
owneraddress can remove funds from the strategy contract to another arbitrary address.The owner can call the
setVaultfunction with an arbitrary and possibly malicious contract address, setting the strategy’svaultto that arbitrary contract. This new arbitrary contract is now free to executeretireStratand extract the strategy’s funds.Additionally, the owner can call the
setUnirouterfunction with an arbitrary and possibly malicious contract address, setting the strategy’sunirouterto that arbitrary contract. The owner can then approve the maximum allowance for any token to that arbitrary address by callingaddRewardToNativeRoute, potentially leading to an extraction of the strategy’s funds.Recommendation
Add a contract level timelock for the
setUnirouterandsetVaultfunctions.To mitigate any centralization risk, it is always recommended that controlling addresses be multi-sig and timelocked. It is known that Beefy Finance’s owner address is in fact a timelocked multi-sig, therefore this centralization risk is considered low.
-
STR-2 Low Unchecked Return Value Control Flow Resolved
Description
Both the
transferandswapExactTokensForTokensfunctions have return values that should be checked, otherwise some unexpected exception may occur. It is important to have some logic in the event these executions fail.Recommendation
Check the return values, or opt for a
safeTransferalternative. -
STR-3 Low Unnecessary Code Code Cleanliness Resolved
Description
The strategy contains 8 individual
IERC20(want).balanceOf(address(this))calls, but this code is already abstracted in thebalanceOfWantfunction.Recommendation
Reuse the
balanceOfWantfunction in these 8 spots for improved code readability and maintainability. -
STR-4 Low Function Visibility Modifiers Optimization Resolved
Description
The functions
callReward,panic,userAccountData,outputToNative,rewardToNative, andnativeToWantare marked aspublic, but are never called from inside the contract.Recommendation
The functions
callReward,panic,userAccountData,outputToNative,rewardToNative, andnativeToWantcan be markedexternalfor gas optimization. -
STR-5 Low Contract Inheritance Structure Code Cleanliness Resolved
Description
The
StrategyGeistcontract inherits from theStratManagerandFeeManagercontracts, but notice that theFeeManagercontract also inherits from theStratManagercontract.Recommendation
Alter the inheritance hierarchy so that there are no redundancies, or provide a veritable reason for such an inheritance structure.
-
STR-6 Low Redundant Require Statement Code Cleanliness Resolved
Description
The
require(msg.sender == vault, "!vault")require statement appears 3 separate times at the beginning ofbeforeDeposit,withdraw, andretireStrat.Recommendation
Consider making this requires statement into a reusable modifier.
-
STR-7 Low Incongruent Error Strings Code Cleanliness Resolved
Description
The contract contains two require statements:
require(_borrowRate <= borrowRateMax, "!safe")on line 1596 andrequire(_borrowRate <= borrowRateMax, "!rate")on line 1616 that enforce the same restrictions, but yield different error strings.Recommendation
Consider standardizing these error strings.
-
STR-8 Low Extraneous Function Code Cleanliness Resolved
Description
The implementation for the
harvestandmanagerHarvestfunctions is exactly the same, the only difference being that the manager can call themanagerHarvestfunction.Recommendation
Remove the
managerHarvestfunction or provide a veritable reason for its existence.
No findings match.
Put your code through the same review.
This review started with a conversation about scope. Tell us what you are building and we will plan yours with you.
