If you notice some outdated information please let us know!
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 audit 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 Mainnet that gets reviewed and its corresponding software repository. The document explaining these questions is here.
1. Are the executing code addresses readily available? (%)
They are available at website https://integrations.barnbridge.com/smart-contract-addresses as indicated in the Appendix.
2. Is the code actively being used? (%)
3. Is there a public software repository? (Y/N)
GitHub: https://github.com/BarnBridge
Is there a public software repository with the code at a minimum, but also normally test and scripts. Even if the repository was created just to hold the files and has just 1 transaction, it gets a "Yes". For teams with private repositories, this answer is "No"
4. Is there a development history visible? (%)
With 170 commits and 18 branches, this is a healthy repository.
This metric checks if the software repository demonstrates a strong steady history. This is normally demonstrated by commits, branches and releases in a software repository. A healthy history demonstrates a history of more than a month (at a minimum).
5. Is the team public (not anonymous)? (Y/N)
The names of the team members can be found on their about page.
For a "Yes" in this question, the real names of some team members must be public on the website or other documentation (LinkedIn, etc). If the team is anonymous, then this question is a "No".
This section looks at the software documentation. The document explaining these questions is here.
6. Is there a whitepaper? (Y/N)
7. Are the basic software functions documented? (Y/N)
Some of the Software functions for the BarnBridge_Barn are explained in their github repository. Barnbridge additionally has a spec.md file for their BarnBridge-SmartYieldBonds contracts.
8. Does the software function documentation fully (100%) cover the deployed contracts? (%)
9. Are there sufficiently detailed comments for all functions within the deployed contract code (%)
The Comments to Code (CtC) ratio is the primary metric for this score.
10. Is it possible to trace from software documentation to the implementation in code (%)
With https://integrations.barnbridge.com/ being more publicly available and being implemented more in their GitHub repos,
11. Full test suite (Covers all the deployed code) (%)
This score is guided by the Test to Code ratio (TtC). Generally a good test to code ratio is over 100%. However the reviewers best judgement is the final deciding factor.
12. Code coverage (Covers all the deployed lines of code, or explains misses) (%)
There is no indication of code coverage in the deployed docs, but it is indicated in the Quantstamp audit, and there are clearly a complete set of tests in the Barn repository, YieldFarmContinous Repository, and SMART Yield repository.
13. Scripts and instructions to run the tests? (Y/N)
Scripts and instructions to run the tests can be found in their GitHub repository.
14. Report of the results (%)
15. Formal Verification test done (%)
There is no evidence of any formal verification testing having been done.
16. Stress Testing environment (%)
BarnBridge Testnet on Kovan. - Kovan tokens available: BOND, USDC, DAI, USDT - Use the faucets to get tokens https://testnet.app.barnbridge.com/
This section looks at the 3rd party software audits done. It is explained in this document.
17. Did 3rd Party audits take place? (%)
18. Is the bug bounty acceptable high? (%)
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. Can a user clearly and quickly find the status of the access controls (%)
Access controls can be found in their whitepaper (3.2), as well as in their GitBooks.
20. Is the information clear and complete (%)
21. Is the information in non-technical terms that pertain to the investments (%)
Clear language in https://docs.barnbridge.com/governance/beginners-guide-to-governance.
22. Is there Pause Control documentation including records of tests (%)
1// SPDX-License-Identifier: Apache-2.0
2pragma solidity 0.7.6;
3pragma experimental ABIEncoderV2;
4
5import "./interfaces/IDiamondCut.sol";
6import "./interfaces/IDiamondLoupe.sol";
7import "./libraries/LibDiamond.sol";
8import "./libraries/LibOwnership.sol";
9import "./libraries/LibDiamondStorage.sol";
10import "./interfaces/IERC165.sol";
11import "./interfaces/IERC173.sol";
12
13contract Barn {
14 constructor(IDiamondCut.FacetCut[] memory _diamondCut, address _owner) payable {
15 require(_owner != address(0), "owner must not be 0x0");
16
17 LibDiamond.diamondCut(_diamondCut, address(0), new bytes(0));
18 LibOwnership.setContractOwner(_owner);
19
20 LibDiamondStorage.DiamondStorage storage ds = LibDiamondStorage.diamondStorage();
21
22 // adding ERC165 data
23 ds.supportedInterfaces[type(IERC165).interfaceId] = true;
24 ds.supportedInterfaces[type(IDiamondCut).interfaceId] = true;
25 ds.supportedInterfaces[type(IDiamondLoupe).interfaceId] = true;
26 ds.supportedInterfaces[type(IERC173).interfaceId] = true;
27 }
28
29 / Find facet for function that is called and execute the
30 / function if a facet is found and return any value.
31 fallback() external payable {
32 LibDiamondStorage.DiamondStorage storage ds = LibDiamondStorage.diamondStorage();
33
34 address facet = address(bytes20(ds.facets[msg.sig].facetAddress));
35 require(facet != address(0), "Diamond: Function does not exist");
36
37 assembly {
38 calldatacopy(0, 0, calldatasize())
39 let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0)
40 returndatacopy(0, 0, returndatasize())
41 switch result
42 case 0 {
43 revert(0, returndatasize())
44 }
45 default {
46 return (0, returndatasize())
47 }
48 }
49 }
50
51 receive() external payable {}
52}
Comments to Code: 157 / 613 = 26 %
Tests to Code: 1134 / 613 = 185 %