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://github.com/dhedge/V2-Public/blob/master/publish/matic/versions.json#L338, in mainnet.json, as indicated in the Appendix. Note: Although it is in a .json file, there is a hyperlink in the dHedge documentation titled "dHedge V2 Contracts" that leads you straight to it, hence the 100%
2. Is the code actively being used? (%)
Activity is 25 transactions a day on contract 0xca1207647Ff814039530D7d35df0e1Dd2e91Fa84, as indicated in the Appendix.
3. Is there a public software repository? (Y/N)
GitHub: https://github.com/dhedge/V2-Public
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? (%)
The repository has 781 commits with 3 branches, making this 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)
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.
7. Are the basic software functions documented? (Y/N)
dHedge's basic software functions are well explained in its[ documentation.](Note: Although it is in a .json file, there is a hyperlink in the dHedge documentation titled "dHedge V2 Contracts" that leads you straight to it, hence the 100%)
8. Does the software function documentation fully (100%) cover the deployed contracts? (%)
A second gitbook details every deployed contract with a clear explanation on each respective contract's function.
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 (%)
There is strong association between the code and the docs, but there is no explicit traceability between the docs and the github repository.
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) (%)
An audit conducted by Iosiro found the code coverage to be "satisfactory", though it recommends enhancing this test suite. A percentage of 76% code coverage was given.
13. Scripts and instructions to run the tests? (Y/N)
Scripts/Instructions location: https://github.com/dhedge/V2-Public
14. Report of the results (%)
There is no report of these test results.
15. Formal Verification test done (%)
No formal verification was found.
This section looks at the 3rd party software audits done. It is explained in this document.
17. Did 3rd Party audits take place? (%)
Iosiro conducted an audit before the code was deployed, and the results are public. CertiK did too.
18. Is the bug bounty acceptable high? (%)
There is a bug bounty of up to $50,000 that is not an active program.
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 (%)
Admin control information was found under "dHEDGE token". Even though they have a governance section, it does not explicitly state the degree of control that is exerted over the contracts, hence the 70%.
20. Is the information clear and complete (%)
Contract upgradeability and change potential is intended through the description of user voting power at https://docs.dhedge.org/dht/introduction
21. Is the information in non-technical terms that pertain to the investments (%)
The admin control information explains their software well, but does not necessarily explain why and how user investments are/stay safe.
22. Is there Pause Control documentation including records of tests (%)
There is no documented pause control.
1// @title Pool Factory
2// @dev A Factory to spawn pools
3contract PoolFactory is
4 PausableUpgradeable,
5 ProxyFactory,
6 IHasDaoInfo,
7 IHasFeeInfo,
8 IHasAssetInfo,
9 IHasGuardInfo,
10 IHasPausable
11{
12 using SafeMathUpgradeable for uint256;
13 using AddressHelper for address;
14
15 event FundCreated(
16 address fundAddress,
17 bool isPoolPrivate,
18 string fundName,
19 string managerName,
20 address manager,
21 uint256 time,
22 uint256 managerFeeNumerator,
23 uint256 managerFeeDenominator
24 );
25
26 event DAOAddressSet(address daoAddress);
27
28 event GovernanceAddressSet(address governanceAddress);
29
30 event DaoFeeSet(uint256 numerator, uint256 denominator);
31
32 event ExitFeeSet(uint256 numerator, uint256 denominator);
33
34 event ExitCooldownSet(uint256 cooldown);
35
36 event MaximumSupportedAssetCountSet(uint256 count);
37
38 event LogUpgrade(address indexed manager, address indexed pool);
39
40 event SetPoolManagerFee(uint256 numerator, uint256 denominator);
41
42 event SetMaximumManagerFee(uint256 numerator, uint256 denominator);
43
44 event SetMaximumManagerFeeNumeratorChange(uint256 amount);
45
46 event SetAssetHandler(address assetHandler);
47
48 event SetPoolStorageVersion(uint256 poolStorageVersion);
49
50 event SetManagerFeeNumeratorChangeDelay(uint256 delay);
51
52 address[] public deployedFunds;
53
54 address public override daoAddress;
55 address public governanceAddress;
56
57 address internal _assetHandler;
58 uint256 internal _daoFeeNumerator;
59 uint256 internal _daoFeeDenominator;
60
61 mapping(address => bool) public isPool;
62
63 uint256 private _MAXIMUM_MANAGER_FEE_NUMERATOR;
64 uint256 private _MANAGER_FEE_DENOMINATOR;
65
66 uint256 internal _exitCooldown;
67
68 uint256 internal _maximumSupportedAssetCount;
69
70 mapping(address => uint256) public poolVersion;
71 uint256 public poolStorageVersion;
72
73 uint256 public override maximumManagerFeeNumeratorChange;
74 uint256 public override managerFeeNumeratorChangeDelay;
75
76 /// @notice Initialize the factory
77 /// @param _poolLogic The pool logic address
78 /// @param _managerLogic The manager logic address
79 /// @param assetHandler The address of the asset handler
80 /// @param _daoAddress The address of the DAO
81 /// @param _governanceAddress The address of the governance contract
82 function initialize(
83 address _poolLogic,
84 address _managerLogic,
85 address assetHandler,
86 address _daoAddress,
87 address _governanceAddress
88 ) external initializer {
89 __ProxyFactory_init(_poolLogic, _managerLogic);
90 __Pausable_init();
91
92 _setAssetHandler(assetHandler);
93
94 _setDAOAddress(_daoAddress);
95
96 _setGovernanceAddress(_governanceAddress);
97
98 _setMaximumManagerFee(5000, 10000);
99
100 _setDaoFee(10, 100); // 10%
101 _setExitCooldown(1 days);
102 setManagerFeeNumeratorChangeDelay(4 weeks);
103 setMaximumManagerFeeNumeratorChange(1000);
104
105 _setMaximumSupportedAssetCount(10);
106
107 _setPoolStorageVersion(230); // V2.3.0;
108 }
109
110 /// @notice Function to create a new fund
111 /// @param _privatePool A boolean indicating whether the fund is private or not
112 /// @param _manager A manager address
113 /// @param _managerName The name of the manager
114 /// @param _fundName The name of the fund
115 /// @param _fundSymbol The symbol of the fund
116 /// @param _managerFeeNumerator The numerator of the manager fee
117 /// @param _supportedAssets An array of supported assets
118 /// @return fund Address of the fund
119 function createFund(
120 bool _privatePool,
121 address _manager,
122 string memory _managerName,
123 string memory _fundName,
124 string memory _fundSymbol,
125 uint256 _managerFeeNumerator,
126 IHasSupportedAsset.Asset[] memory _supportedAssets
127 ) external returns (address fund) {
128 require(!paused(), "contracts paused");
129 require(_supportedAssets.length <= _maximumSupportedAssetCount, "maximum assets reached");
130 require(_managerFeeNumerator <= _MAXIMUM_MANAGER_FEE_NUMERATOR, "invalid manager fee");
131
132 bytes memory poolLogicData =
133 abi.encodeWithSignature(
134 "initialize(address,bool,string,string)",
135 address(this),
136 _privatePool,
137 _fundName,
138 _fundSymbol
139 );
140
141 fund = deploy(poolLogicData, 2);
142
143 bytes memory managerLogicData =
144 abi.encodeWithSignature(
145 "initialize(address,address,string,address,uint256,(address,bool)[])",
146 address(this),
147 _manager,
148 _managerName,
149 fund,
150 _managerFeeNumerator,
151 _supportedAssets
152 );
153
154 address managerLogic = deploy(managerLogicData, 1);
155 // Ignore return value as want it to continue regardless
156 IPoolLogic(fund).setPoolManagerLogic(managerLogic);
157
158 deployedFunds.push(fund);
159 isPool[fund] = true;
160
161 poolVersion[fund] = poolStorageVersion;
162
163 emit FundCreated(
164 fund,
165 _privatePool,
166 _fundName,
167 _managerName,
168 _manager,
169 block.timestamp,
170 _managerFeeNumerator,
171 _MANAGER_FEE_DENOMINATOR
172 );
173 }
174
Comments to Code: 1388 / 2443 = 57 %
Tests to Code: 1505 / 2443 = 62 %