Guardian's review of Kodiak MIM-HONEY Island Market for Abracadabra Money, published February 2025. The report records 16 findings, including 3 medium and 13 low.
- Published
- Review window
- February 2 to 8, 2025
- Language
- Solidity
- Chains
- Berachain
- Sector
- Lending, Yield and vaults, DEXs and AMMs
- 0 Critical
- 0 High
- 3 Medium
- 13 Low
- 0 Informational
Findings 16
-
M-01 Medium Harvest DoS For Zero Reward Tokens DoS Resolved
Description
In the MagicKodiakVault
harvestfunction thetransferfunction is attempted to be used for every reward token. However if there are currently zero rewards for any individual reward token that reverts on zero transfers then theharvestfunction will revert and prevent the claiming of all rewards.Recommendation
Consider only transferring rewards for the reward token if there is a nonzero contract balance for that reward.
-
M-02 Medium Reward Distributions Can Be Sandwhiched Sandwhich Attack Acknowledged
Description
In the
MagicKodiakVaultthedistributeRewardsfunction increments the_totalAssetsof the vault in a stepwise manner. This can allow for sandwhich attack arbitrage opportunities when the reward amount is large. A malicious actor can see a reward distribution in the mempool and frontrun/backrun it to immediately gain from the distributed amount without holding exposure to the vault for the same time as the users who provided the capital to generate the rewards. Furthermore, even if a private RPC is used a preliminaryharvesttransaction may be used as an indicator thatdistributeRewardsis about to be called after swapping reward tokens to the target asset. This would allow a malicious actor to frontrun and backrun reward distributions without necessary knowledge of thedistributeRewardstransaction in the mempool, however this is not a guaranteed profit.Recommendation
Be sure to use a private RPC to call the
distributeRewardsfunction. Otherwise be sure to keep the reward distributions small and infrequent. A more long term solution is to consider refactoring the reward distribution logic so that the totalAssets increment is gradual rather than instantaneous. -
M-03 Medium Harvester Is Not Set As Operator Configuration Resolved
Description
The Harvester address
0xB76403D52CA4D4f5C791859d93553E14742cc9d1is currently not assigned as an operator for the vault proxy address0x548eAf30BAD1B4f697fBAC88712fc8148Dc0aA75. Instead the deployer address0xfb3485c2e209a5cfbdc1447674256578f1a80ee3is currently assigned as an operator.Recommendation
Add the operator role to the harvester and consider removing the operator role from the deployer.
-
L-01 Low Vault Address Points To Mock Warning Resolved
Description
Within bera.json, address
0x7FC70DfE186b1eF1B792d1c42C3b7De09F4a68a7does not point to the Infrared MIM-Honey vault but instead to a mock contract.Recommendation
Ensure the address is updated prior to MagicKodiakVault deployment.
-
L-02 Low Dummy Honey-USD Price Feed Warning Resolved
Description
Currently the
redstoneHoneyAggregatoris set to an aggregator that will always return a $1 fixed price which will affect the calculated price of the collateral.Recommendation
Ensure the aggregator is updated to the proper Redstone address for live deployment.
-
L-03 Low Repetitive Cauldron Naming Warning Resolved
Description
”MagicKodiakCauldron” is supplied as the
nameto function_deployCauldron. Consequently, when the cauldron is actually deployed, it’s deployment name will beCauldron_MagicKodiakCauldron.Recommendation
Consider adjusting the name as necessary such that is adheres to Abracadabra’s standards.
-
L-04 Low Reward Vault Unwhitelisted DoS Warning Acknowledged
Description
Infrared vaults rely on being whitelisted so that they can interact with the Berachain reward vaults during staking and unstaking. However,
setVaultWhitelistedStatuscan be used by governance to revoke whitelisted status (see doc), which would ultimately prevent the ability for new stakes to occur into the MagicKodiakVault.Recommendation
Clearly document this risk.
-
L-05 Low Lacking Staleness Checks In KodiakIslandAggregator Validation Acknowledged
Description
The
KodiakIslandAggregatorcontract performs no staleness checks on the underlying aggregator feeds. Therefore this aggregator is at risk of reporting inaccurate prices when one of the underlying feeds is outdated.Recommendation
Be aware of this issue and consider adding staleness validation controls depending on if a feed implements staleness checks.
-
L-06 Low Lacking Aggregator Validations Validation Resolved
Description
The
KodiakIslandAggregatorcontract is missing several validations which can be crucial in avoiding a mispricing or manipulation in edge case scenarios. Firstly, thelatestAnswerfunction lacks validation that requires thetotalSupplyto be above a menial threshold to avoid unexpected low precision manipulations with small amounts of collateral. It also lacks validation which would prevent a divide by zero revert when thetotalSupplyis zero. The Maker DAOGUniLPOraclevalidates this by ensuring that thetotalSupplyis above 1e9. Secondly there are several casts performed which do not include safety reverts if an overflow would have occurred. The_getSqrtPriceX96function does not include any reverts if the uint160 cast would overflow, though such an overflow would be extremely unlikely. Additionally, there is no validation that the result oftotalValue / totalSupplydoes not overflow theint256result. Both scenarios are unlikely, however should be validated against to avoid any unexpected manipulations. -
L-07 Low Incorrect Decimals Assumption Warning Resolved
Description
**The **
KodiakIslandAggregatorcontract reports a decimals of theIERC20Metadata(address(island)).decimals()result, however this is incorrect when theIERC20Metadata(address(island)).decimals()result is not equal to 18. Consider the existing case, when the island decimals are 18:normalizedReserve0andnormalizedReserve1are 1e18 decimalsnormalizedPriceFeed0andnormalizedPriceFeed1are 1e18 decimals- The resulting
totalValueis 1e36 decimals - Assume totalValue is $1, e.g. 1e36
- Assume totalSupply is 1 token, e.g. 1e18
- The resulting price is 1e36/1e18 == 1e18 which is correctly $1 with 18 decimals
However for a case where the island decimals are 8:
normalizedReserve0andnormalizedReserve1are 1e18 decimalsnormalizedPriceFeed0andnormalizedPriceFeed1are 1e18 decimals- The resulting
totalValueis 1e36 decimals - Assume totalValue is $1, e.g. 1e36
- Assume totalSupply is 1 token, e.g. 1e8
- The resulting price is 1e36/1e8 == 1e28 which is incorrectly reporting a very large price for an 8 decimal feed
Recommendation
Instead of assigning the decimals for the feed as the
IERC20Metadata(address(island)).decimals()result, either hardcode the decimals as 18 and document that this aggregator is incompatible with any other island decimals. Or assign the decimals as:36 - IERC20Metadata(address(island)).decimals(). -
L-08 Low LP Token Rewards Cannot Be Harvested Warning Resolved
Description
In the
runfunction the LP token balance of the harvester contract before theaddLiquiditycall is removed from the amount which can be rewarded to the vault. This prevents LP token rewards that were harvested from being distributable back to theMagicKodiakVault. However it is unlikely that LP tokens will be supported as a direct reward token.Recommendation
This finding simply serves as a warning since it is unlikely that the LP token will be a reward token for the Infrared vault. However if it is then this logic should be amended in a new harvester contract. Additionally, consider adding a token rescue function in the event that LP tokens are sent to this contract either as a reward or by accident and cannot be recovered.
-
L-09 Low Dangling Approvals If Reward Tokens Are Removed Warning Resolved
Description
In the
setExchangeRouterfunction the approvals are removed for all existing reward tokens from the previousexchangeRoutercontract. However if a reward is removed from the infrared vault with theremoveRewardfunction then this token approval will not be removed from the previousexchangeRouterupon the nextexchangeRouterupdate.Recommendation
Consider adding an additional function to remove targeted approvals from an existing or past
exchangeRoutercontract for cases where the reward tokens are updated. -
L-10 Low New Reward Tokens Require More Approvals Warning Resolved
Description
New reward tokens may be added to the Infrared vault with the
addRewardfunction. These reward tokens will require additional approvals to be made to theexchangeRoutercontract.Recommendation
Currently this can be achieved by using the
setExchangeRouterfunction to set the sameexchangeRouterimplementation in order to approve all new tokens. Be aware that this scenario may arise. -
L-11 Low Unnecessary SwapData Fields Optimization Resolved
Description
**The **
SwapInfostruct contains two unnecessary fields, thetokenandamountfields, which are not used in the implementation anywhere.Recommendation
Remove these unnecessary fields from the
SwapInfostruct. -
L-12 Low Unnecessary Import Suggestion Resolved
Description
The
IERC20import in theMagicKodiakVaultHarvestercontract is unused.Recommendation
Consider removing this import.
-
L-13 Low Lacking Fee Configuration Configuration Resolved
Description
In the deployed harvester contract the fee basis points and fee receiver have not been configured.
Recommendation
Consider if this is the expected state, and if not be sure to configure the fee amount and receiver as they are expected to be.
No findings match.
More from Abracadabra Money
All 19 reports-
MagicGLP Upgrade
11 findings1 high 11 findings: 1 high, 10 low -
PurrSwap Aerodrome
105 findings9 high 105 findings: 9 high, 23 medium, 45 low, 28 informational -
PurrSwap ve33
74 findings5 critical · 10 high 74 findings: 5 critical, 10 high, 20 medium, 39 low -
Hyperliquid OFT Deployment
3 findings 3 findings: 1 low, 2 informational
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.
