Omniscia KlimaDAO Audit

Algorithmic Bonding System Security Audit

We were tasked with performing an audit of the KlimaDAO codebase and in particular their Olympus V1 & V2 inspired bonding implementation as well as their multi-token implementations that support the ecosystem.

The main differentiation from the Olympus DAO implementation is the more granular approach to the bond depositories whereby a contract is independently deployed for each depository that consequently directly interacts and deposits to the treasury before gradually releasing funds to the end-users via a typical vesting schedule.

As an internal note, the audit will not be finalized as long as the codebase retains flattened contracts given that we have identified vulnerabilities in dependencies that are shared across multiple contracts and would lead to a high amount of findings that are duplicated across contracts. We strongly advise the KlimaDAO team to clean up the codebase and use proper inheritence structures.

Over the course of the audit, we identified multiple vulnerabilities some of which were inherited from an unfixed version of the Olympus DAO codebase while others were the result of KlimaDAO's adaptations to the original codebase, such as an incorrect markdown calculation within the new bonding calculator. Furthermore, we identified multiple gas optimizations across the codebase that should be applied given that the code is relatively inefficient.

We advise the KlimaDAO team to remediate all minor-and-above vulnerabilities identified within the report as well as consider and apply our gas optimization findings. We should note that the codebase can be significantly optimized beyond our gas optimization findings as the report cannot contain all potential optimizations that can be made.

On a final note, the codebase appears to not properly test the new features introduced to it by the KlimaDAO team. In order for the codebase to be considered deployment ready, the KlimaDAO team should introduce test cases that test the bare minimum functionalities meant to be supported by the protocol as vulnerabilities such as the markdown calculation would have been caught in such a case prior to the audit.

Files in ScopeRepositoryCommit(s)
AltExercisepKLIMA.sol (AEK)klimadao-solidityb8792aa453,
599619a80d
AlphaKlimaUpgradeable.sol (AKU)klimadao-solidityb8792aa453,
599619a80d
AlchemistKlimaUpgradeable.sol (CON)klimadao-solidityb8792aa453,
599619a80d
AlphaKlimaRedeemUpgradeable.sol (AKR)klimadao-solidityb8792aa453,
599619a80d
ExercisepKLIMA.sol (EKL)klimadao-solidityb8792aa453,
599619a80d
KlimaToken.sol (KTN)klimadao-solidityb8792aa453,
599619a80d
KlimaIDONFT.sol (KID)klimadao-solidityb8792aa453,
599619a80d
KlimaTreasury.sol (KTY)klimadao-solidityb8792aa453,
599619a80d
KlimaLPStaking.sol (KLP)klimadao-solidityb8792aa453,
599619a80d
KlimaLPBonds_v4.sol (KLB)klimadao-solidityb8792aa453,
599619a80d
KlimaStaking_v2.sol (KS2)klimadao-solidityb8792aa453,
599619a80d
KlimaLPBonds_v4_GSN.sol (KLG)klimadao-solidityb8792aa453,
599619a80d
KlimaVCU20Depository.sol (KVC)klimadao-solidityb8792aa453,
599619a80d
KlimaBondingCalculator_v2.sol (KBC)klimadao-solidityb8792aa453,
599619a80d
KlimaStakingDistributor_v4.sol (KSD)klimadao-solidityb8792aa453,
599619a80d
KlimaCirculatingSupplyContract.sol (KCS)klimadao-solidityb8792aa453,
599619a80d
PreKlimaTokenUpgradeable.sol (PKT)klimadao-solidityb8792aa453,
599619a80d
PreKlimaTokenUpgradeableChild.sol (PKU)klimadao-solidityb8792aa453,
599619a80d
StakingHelper.sol (SHR)klimadao-solidityb8792aa453,
599619a80d
StakingWarmup.sol (SWP)klimadao-solidityb8792aa453,
599619a80d
sKlimaToken_v2.sol (KT2)klimadao-solidityb8792aa453,
599619a80d
wsKLIMA.sol (KLI)klimadao-solidityb8792aa453,
599619a80d

During the audit, we filtered and validated a total of 9 findings utilizing static analysis tools as well as identified a total of 52 findings during the manual review of the codebase. We strongly recommend that any minor severity or higher findings are dealt with promptly prior to the project's launch as they introduce potential misbehaviours of the system as well as exploits.

The list below covers each segment of the audit in depth and links to the respective chapter of the report: