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 relevant chain that gets reviewed and its corresponding software repository. The document explaining these questions is here.
1. Are the smart contract addresses easy to find? (%)
The Smart Contract addresses for Notional V2 can clearly be found at https://docs.notional.finance/developer-documentation/#deployed-contract-addresses.
2. How active is the primary contract? (%)
Contract nProxy.sol is used about 10 times a day, as indicated in the Appendix.
3. Does the protocol have a public software repository? (Y/N)
GitHub: https://github.com/notional-finance/contracts-v2
4. Is there a development history visible? (%)
With 752 commits and 49 branches this is a healthy development history
5. Is the team public (not anonymous)?
We found the team on the discord server. Where we found the team is documented in our team appendix at the end of this report.
The difference between this and the old link is solely the link. This section looks at the software documentation. The document explaining these questions is here.
6. Is there a whitepaper? (Y/N)
Location: https://github.com/notional-finance/contracts-v2/blob/master/WHITEPAPER.md
7. Is the protocol's software architecture documented? (Y/N)
This protocol's software architecture is documented in whitepaper and a youtube video.
8. Does the software documentation fully cover the deployed contracts' source code? (%)
There is significant comments in the deployed code and the included "tech deep dive" youtube video functionally gives very good but not complete coverage of deployed contracts by software function documentation. However, paired with their v1 whitepaper and v2 whitepaper, they effectively cover all contracts / functions.
9. Is it possible to trace the documented software to its implementation in the protocol's source code? (%)
There is clear but not explicit traceability between software documentation and implemented code through the comments and the video.
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 148% 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.
11. How covered is the protocol's code? (%)
They discuss aspects of the coverage and the limitations of the test tools in giving coverage however at no time do they give the coverage they have achieved. Therefore we give them 50% as they clearly has a good test suite.
12. Does the protocol provide scripts and instructions to run their tests? (Y/N)
Test scripts are at : https://github.com/notional-finance/contracts-v2/tree/master/scripts
13. Is there a detailed report of the protocol's test results?(%)
No test report evident
14. Has the protocol undergone Formal Verification? (Y/N)
This protocol has undergone formal verification. The report is at : https://github.com/notional-finance/contracts-v2/blob/master/audits/Certora%20-%20Formal%20Verfication%20Report%2C%20Nov%201%202021.pdf
15. Were the smart contracts deployed to a testnet? (Y/N)
This protocol has been deployed to a Kovan
This section looks at the 3rd party software audits done. It is explained in this document.
16. Is the protocol sufficiently audited? (%)
Multiple audits before deployment at https://github.com/notional-finance/contracts-v2/tree/master/audits. These audits seem thorough and it appears the changes were implemented.
17. Is the bounty value acceptably high (%)
This protocol offers an active bug bounty of $1M
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.
18. Is the protocol's admin control information easy to find?
Notional's Admin Controls were easily found at https://docs.notional.finance/developer-documentation/on-chain/notional-governance-reference.
19. Are relevant contracts clearly labelled as upgradeable or immutable? (%)
Notional is described as fully upgradeable here.
20. Is the type of smart contract ownership clearly indicated? (%)
Notional's ownership and administrative control consists of a 3 of 5 MultiSig architecture.
21. Are the protocol's smart contract change capabilities described? (%)
Smart contract change capabilities are mentioned but not clearly described.
22. Is the protocol's admin control information easy to understand? (%)
Notional's administrative documentation is written in software-like language, and does not necessarily related to the safety of user funds within this architecture.
23. Is there sufficient Pause Control documentation? (%)
Notional's Pause Guardian was clearly detailed here.
24. Is there sufficient Timelock documentation? (%)
Notional mentions that their upgradeable structure does not include a timelock, but this decision is not further justified.
25. Is the Timelock of an adequate length? (Y/N)
Notional mentions that their upgradeable structure does not include a timelock, but this decision is not further justified.
This section goes over the documentation that a protocol may or may not supply about their Oracle usage. Oracles are a fundamental part of DeFi as they are responsible for relaying tons of price data information to thousands of protocols using blockchain technology. Not only are they important for price feeds, but they are also an essential component of transaction verification and security. This is explained in this document.
26. Is the protocol's Oracle sufficiently documented? (%)
The protocol's oracle source is documented at this location. The contracts dependent are identified.
27. Is front running mitigated by this protocol? (Y/N)
Notional does not detail any front-running mitigation strategies. However, its fixed rate and liquidity architectures inherently mitigate front running liquidation opportunities. Details on the aforementioned architectures can be found here.
28. Can flashloan attacks be applied to the protocol, and if so, are those flashloan attack risks mitigated? (Y/N)
This protocol documents flashloan countermeasures at this location.
1// SPDX-License-Identifier: GPL-3.0-only
2pragma solidity ^0.7.0;
3pragma abicoder v2;
4
5import "../internal/AccountContextHandler.sol";
6import "../internal/valuation/FreeCollateral.sol";
7
8/// @title Externally deployed library for free collateral calculations
9library FreeCollateralExternal {
10 using AccountContextHandler for AccountContext;
11
12 /// @notice Returns the ETH denominated free collateral of an account, represents the amount of
13 /// debt that the account can incur before liquidation. If an account's assets need to be settled this
14 /// will revert, either settle the account or use the off chain SDK to calculate free collateral.
15 /// @dev Called via the Views.sol method to return an account's free collateral. Does not work
16 /// for the nToken, the nToken does not have an account context.
17 /// @param account account to calculate free collateral for
18 /// @return total free collateral in ETH w/ 8 decimal places
19 /// @return array of net local values in asset values ordered by currency id
20 function getFreeCollateralView(address account)
21 external
22 view
23 returns (int256, int256[] memory)
24 {
25 AccountContext memory accountContext = AccountContextHandler.getAccountContext(account);
26 // The internal free collateral function does not account for settled assets. The Notional SDK
27 // can calculate the free collateral off chain if required at this point.
28 require(!accountContext.mustSettleAssets(), "Assets not settled");
29 return FreeCollateral.getFreeCollateralView(account, accountContext, block.timestamp);
30 }
31
32 /// @notice Calculates free collateral and will revert if it falls below zero. If the account context
33 /// must be updated due to changes in debt settings, will update. Cannot check free collateral if assets
34 /// need to be settled first.
35 /// @dev Cannot be called directly by users, used during various actions that require an FC check. Must be
36 /// called before the end of any transaction for accounts where FC can decrease.
37 /// @param account account to calculate free collateral for
38 function checkFreeCollateralAndRevert(address account) external {
39 AccountContext memory accountContext = AccountContextHandler.getAccountContext(account);
40 require(!accountContext.mustSettleAssets(), "Assets not settled");
41
42 (int256 ethDenominatedFC, bool updateContext) =
43 FreeCollateral.getFreeCollateralStateful(account, accountContext, block.timestamp);
44
45 if (updateContext) {
46 accountContext.setAccountContext(account);
47 }