If you notice some outdated information please let us know!
-5%(Penalty)
PASS
The final review score is indicated as a percentage. The percentage is calculated as Achieved Points due to MAX Possible Points. For each element the answer can be either Yes/No or a percentage. For a detailed breakdown of the individual weights of each question, please consult this document.
Very simply, the review looks for the following declarations from the developer's site. With these declarations, it is reasonable to trust the smart contracts.
This report is for informational purposes only and does not constitute investment advice of any kind, nor does it constitute an offer to provide investment advisory or other services. Nothing in this report shall be considered a solicitation or offer to buy or sell any security, token, future, option or other financial instrument or to offer or provide any investment advice or service to any person in any jurisdiction. Nothing contained in this report constitutes investment advice or offers any opinion with respect to the suitability of any security, and the views expressed in this report should not be taken as advice to buy, sell or hold any security. The information in this report should not be relied upon for the purpose of investing. In preparing the information contained in this report, we have not taken into account the investment needs, objectives and financial circumstances of any particular investor. This information has no regard to the specific investment objectives, financial situation and particular needs of any specific recipient of this information and investments discussed may not be suitable for all investors.
Any views expressed in this report by us were prepared based upon the information available to us at the time such views were written. The views expressed within this report are limited to DeFiSafety and the author and do not reflect those of any additional or third party and are strictly based upon DeFiSafety, its authors, interpretations and evaluation of relevant data. Changed or additional information could cause such views to change. All information is subject to possible correction. Information may quickly become unreliable for various reasons, including changes in market conditions or economic circumstances.
This completed report is copyright (c) DeFiSafety 2023. Permission is given to copy in whole, retaining this copyright label.
This section looks at the code deployed on the relevant chains and team aspects. The document explaining these questions is here.
1. Are the smart contract addresses easy to find? (%)
The Smart contract addresses for Balancer can be found in the "Smart Contracts" section of their documentation here. The addresses are clearly labeled and easy to find, which aligns with the best practices for transparency and accessibility. This question receives a score of 100%.
2. Does the protocol have a public software repository? (Y/N)
3. Is the team public (not anonymous)?
The team is public. The contributors on GitHub is public.
4. How responsive are the devs when we present our initial report?
Devs took more than 72 hours to respond but after were very active. 100%.
This section looks at the software documentation. The document explaining these questions is here.
5. Is there a whitepaper? (Y/N)
Location: https://docs.balancer.fi/concepts/pools/ The documentation on the protocol suffices as a white paper.
6. Is the protocol's software architecture documented? (%)
This protocol's software architecture is in a DeFiLytic tool that links with other detailed docs.
7. Does the software documentation fully cover the deployed contracts' source code? (%)
There is 100% coverage of deployed contracts by software function documentation, which is in the code. As documented below from https://github.com/balancer/balancer-v2-monorepo/blob/master/pkg/pool-linear/contracts/LinearPoolRebalancer.sol function _depositToPool(IERC20 token, uint256 amount) private { // Tokens can be deposited to the Vault with a 'deposit' operation, but that requires a prior 'managed' // balance to exist. We therefore have to perform two operations: one to set the 'managed' balance (representing // the new tokens that resulted from wrapping or unwrapping and which we are managing for the Pool), and // another to deposit. IVault.PoolBalanceOp[] memory deposit = new IVault.PoolBalanceOp; // First, we inform the Vault of the 'managed' tokens. deposit.kind = IVault.PoolBalanceOpKind.UPDATE; deposit[0].poolId = _poolId; deposit[0].amount = amount; deposit[0].token = token; // Then, we deposit them, clearing the 'managed' balance. deposit[1].kind = IVault.PoolBalanceOpKind.DEPOSIT; deposit[1].poolId = _poolId; deposit[1].amount = amount; deposit[1].token = token; // Before we can deposit tokens into the Vault however, we must approve them. token.safeApprove(address(_vault), amount); _vault.managePoolBalance(deposit); } function _getDesiredMainTokenBalance() private view returns (uint256) { // The desired main token balance is the midpoint of the lower and upper targets. Keeping the balance // close to that value maximizes Pool swap volume by allowing zero-fee swaps in either direction. (uint256 lowerTarget, uint256 upperTarget) = _pool.getTargets(); uint256 midpoint = (lowerTarget + upperTarget) / 2;
8. Is it possible to trace the documented software to its implementation in the protocol's source code? (%)
There is some implicit traceability between software documentation and implemented code. The documentation is in the comments, right with the code. I will give this an 80%
9. Is the documentation organized to ensure information availability and clarity? (%)
Information is well organized.
This section covers the testing process of the protocol’s smart contract code previous to its deployment on the mainnet. The document explaining these questions is here.
10. Has the protocol tested their deployed code? (%)
Code examples are in the Appendix at the end of this report.. As per the SLOC, there is 329% testing to code (TtC). This score is guided by the Test to Code ratio (TtC). Generally a good test to code ratio is over 100%. However, the reviewer's best judgement is the final deciding factor. TtC = 70602 / 21406 =329% ─────────────────────────────────────────────────────────────────────────────── Language Files Lines Blanks Comments Code Complexity ─────────────────────────────────────────────────────────────────────────────── JavaScript 102 21406 3194 6611 11601 1161 ─────────────────────────────────────────────────────────────────────────────── Total 102 21406 3194 6611 11601 1161 ─────────────────────────────────────────────────────────────────────────────── Estimated Cost to Develop $354,254 Estimated Schedule Effort 9.271584 months Estimated People Required 3.394513 ─────────────────────────────────────────────────────────────────────────────── Processed 942299 bytes, 0.942 megabytes (SI) ─────────────────────────────────────────────────────────────────────────────── Language Files Lines Blanks Comments Code Complexity ─────────────────────────────────────────────────────────────────────────────── TypeScript 140 54069 9447 1140 43482 2201 JavaScript 133 10143 1879 1871 6393 251 Markdown 1 6390 7 0 6383 0 ─────────────────────────────────────────────────────────────────────────────── Total 274 70602 11333 3011 56258 2452 ─────────────────────────────────────────────────────────────────────────────── Estimated Cost to Develop $1,859,040 Estimated Schedule Effort 17.407797 months Estimated People Required 9.487700 ─────────────────────────────────────────────────────────────────────────────── Processed 2978856 bytes, 2.979 megabytes (SI) ───────────────────────────────────────────────────────────────────────────────
11. How covered is the protocol's code? (%)
50% No indication of code coverage but clearly there is a complete set of tests. For Balancer for specifically "coverage" testing, that is tough on V2, since our code breaks the standard tools (specifically, the way we do errors with BalancerErrors, as it involves encoded strings in assembly). Balancer is working on getting around that, at least for future development.
12. Is there a detailed report of the protocol's test results?(%)
On #12, Balancer has an extremely robust CI process. For instance . With every deployment, they generate and compare the bytecode with the deployed versions on chain, ensuring that the source code (i.e., build-info) in the repo is correct. It also computes and verifies the action-ids, which are used for generating permissions (so this is an integrity and important security check, as this is what the Maxis use to create governance transactions). Additionally, it generates and checks the deployment addresses of all contracts, including their active or deprecated status. This is great documentation for integrators. Finally, it verifies that all links in the documents are valid, ensuring the comments and markdown files are up-to-date.
13. Has the protocol undergone Formal Verification? (Y/N)
This protocol has undergone formal verification. https://github.com/balancer/balancer-v2-monorepo/blob/master/audits/certora/2021-04-22.pdf
This section looks at the 3rd party software audits done. It is explained in this document.
14. Is the protocol sufficiently audited? (%)
Multiple high quality audits. Top notch
15. Is there a matrix of audit applicability on deployed code (%)? Please refer to the example doc for reference.
The list of audits indicates the element of the software that was audited and the date and the applicability of the audit. Ideal, 100%
16. Is the bug bounty value acceptably high (%)
This protocol offers an active bug bounty of $1,000K
17. Is there documented protocol monitoring (%)?
There is no documentation on protocol monitoring
18. Is there documented protocol front-end monitoring (%)?
There is no documentation on protocol monitoring [...]
This section covers the documentation of special access controls for a DeFi protocol. The admin access controls are the contracts that allow updating contracts or coefficients in the protocol. Since these contracts can allow the protocol admins to "change the rules", complete disclosure of capabilities is vital for user's transparency. It is explained in this document.
19. Is the protocol code immutable or upgradeable? (%)
This is immutable code.
20. Is the protocol's code upgradeability clearly explained in non technical terms? (%)
100% Code is Immutable and clearly indicated so in documentation
21. Are the admin addresses, roles and capabilities clearly explained? (%)
22. Are the signers of the admin addresses clearly listed and provably distinct humans? (%)
All signers are clearly listed here. Many are provably human. Therefore 80%. Our goal is that evidence of clearly distinct human becomes part of this data set either through Gitcoin passport, KYC or even DeFiSafety multisig certification. But this list is very good.
23. Is there a robust documented transaction signing policy? Please refer to the Example doc for reference.(%)
Signer duties gives at least documentation about liveliness. While a quality protocol such as Balancer I am personally confident that all of the signers are conscientious about their transaction signing processes. The goal of this question is to normalize documenting the minimum acceptable process and checking signers against it. The goal is to start processes that allow lost key hacks to slowly disappear. We will give 20% for the signer duties comments.