logo
bg_imgbg_imgbg_imgbg_img
exclamation mark iconReport an issue

If you notice some outdated information please let us know!

close icon
Name
Email
Your message
arrow-left

InstaDapp

85%

Previous versions

Process Quality Review (0.8)

InstaDapp

Final score:85%
Date:30 Aug 2022
Audit Process:version 0.8
Author:Ryoma
PQR Score:85%

PASS

Protocol Website:https://instadapp.io/

Scoring Appendix

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.

The blockchain used by this protocol
Arbitrum
Avalanche
Ethereum
Fantom
Polygon
Optimism
#QuestionAnswer
100%
1.100%
2.100%
3.Yes
4.100%
5.100
86%
6.Yes
7.Yes
8.80%
9.60%
80%
10.100%
11.100%
12.Yes
13.100%
14.No
15.No
85%
16.90%
17.50%
71%
18.100%
19.100%
20.100%
21.0%
22.100%
23.0%
24.60%
25.100%
100%
26.100
27.Yes
28.Yes
Total:85%

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.

  • Here is my smart contract on the blockchain
  • You can see it matches a software repository used to develop the code
  • Here is the documentation that explains what my smart contract does
  • Here are the tests I ran to verify my smart contract
  • Here are the audit(s) performed to review my code by third party experts

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.

Smart Contracts & Team

100%

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? (%)

Answer: 100%

InstaDapp's smart contracts can be found under the respective platform's tabs in their documentation; Ethereum Mainnet's smart contracts can be found here. A screenshot of a sample of addresses can be found in the appendix.

Percentage Score Guidance:
100%
Clearly labelled and on website, documents or repository, quick to find
70%
Clearly labelled and on website, docs or repo but takes a bit of looking
40%
Addresses in mainnet.json, in discord or sub graph, etc
20%
Address found but labeling not clear or easy to find
0%
Executing addresses could not be found

2. How active is the primary contract? (%)

Answer: 100%

The protocol's Index contract logs in more than 10 internal transactions a day, earning the protocol a 100% on this question. A screenshot of their transaction history can be found in the appendix.

Percentage Score Guidance:
100%
More than 10 transactions a day
70%
More than 10 transactions a week
40%
More than 10 transactions a month
10%
Less than 10 transactions a month
0%
No activity

3. Does the protocol have a public software repository? (Y/N)

Answer: Yes

InstaDapp's software repo can be found here.

Score Guidance:
Yes
There is 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.
No
For teams with private repositories.

4. Is there a development history visible? (%)

Answer: 100%

Found in the GitHub, Instadapp's dsa-connectors repository records a total of 1196 commits and 5 branches, giving the protocol a nice 100%.

Percentage Score Guidance:
100%
Any one of 100+ commits, 10+branches
70%
Any one of 70+ commits, 7+branches
50%
Any one of 50+ commits, 5+branches
30%
Any one of 30+ commits, 3+branches
0%
Less than 2 branches or less than 30 commits

5. Is the team public (not anonymous)?

Answer: 100

The InstaDapp team can be found on their LinkedIn page. The protocol earns a 100% as 2+ names can be found associated to the page.

Score Guidance:
100%
At least two names can be easily found in the protocol's website, documentation or medium. These are then confirmed by the personal websites of the individuals / their linkedin / twitter.
50%
At least one public name can be found to be working on the protocol.
0%
No public team members could be found.

Documentation

86%

This section looks at the software documentation. The document explaining these questions is here.

6. Is there a whitepaper? (Y/N)

Answer: Yes

The protocol's whitepaper can be found here.

7. Is the protocol's software architecture documented? (Y/N)

Answer: Yes

The protocol's basic functions are described here.

Score Guidance:
Yes
The documents identify software architecture and contract interaction through any of the following: diagrams, arrows, specific reference to software functions or a written explanation on how smart contracts interact.
No
Protocols receive a "no" if none of these are included.

8. Does the software documentation fully cover the deployed contracts' source code? (%)

Answer: 80%

There is partial coverage of deployed contracts by software function documentation; a written description of smart contract functions are available on the same page as the addresses. There are missing contract functions such as InstaFlashResolver, Treasury, etc.

Percentage Score Guidance:
100%
All contracts and functions documented
80%
Only the major functions documented
79 - 1%
Estimate of the level of software documentation
0%
No software documentation

9. Is it possible to trace the documented software to its implementation in the protocol's source code? (%)

Answer: 60%

While there is implicit traceability of smart contract code and documentation, giving the protocol a 60%, InstaDapp could earn 100% by linking the documentation to the source code.

Percentage Score Guidance:
100%
Clear explicit traceability between code and documentation at a requirement level for all code
60%
Clear association between code and documents via non explicit traceability
40%
Documentation lists all the functions and describes their functions
0%
No connection between documentation and code

Testing

80%

10. Has the protocol tested their deployed code? (%)

Answer: 100%

Code examples are in the Appendix at the end of this report.. As per the SLOC, there is 393% 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.

Percentage Score Guidance:
100%
TtC > 120% Both unit and system test visible
80%
TtC > 80% Both unit and system test visible
40%
TtC < 80% Some tests visible
0%
No tests obvious

11. How covered is the protocol's code? (%)

Answer: 100%

InstaDapp's code coverage is fully documented within their GitHub repository.

Percentage Score Guidance:
100%
Documented full coverage
99 - 51%
Value of test coverage from documented results
50%
No indication of code coverage but clearly there is a complete set of tests
30%
Some tests evident but not complete
0%
No test for coverage seen

12. Does the protocol provide scripts and instructions to run their tests? (Y/N)

Answer: Yes

InstaDapp provides scripts to run their tests in each respective smart contract repository. An example of this would be the test repository in dsa-contracts.

Score Guidance:
Yes
Scripts and/or instructions to run tests are available in the testing suite
No
Scripts and/or instructions to run tests are not available in the testing suite

13. Is there a detailed report of the protocol's test results?(%)

Answer: 100%

InstaDapp displays test reports in their GitHub Actions tab, such as here.

Percentage Score Guidance:
100%
Detailed test report as described below
70%
GitHub code coverage report visible
0%
No test report evident

14. Has the protocol undergone Formal Verification? (Y/N)

Answer: No

InstaDapp has not undergone formal verification.

Score Guidance:
Yes
Formal Verification was performed and the report is readily available
No
Formal Verification was not performed and/or the report is not readily available.

15. Were the smart contracts deployed to a testnet? (Y/N)

Answer: No

InstaDapp has not provided any smart contract address issued from their testnet usage.

Score Guidance:
Yes
Protocol has proved their tesnet usage by providing the addresses
No
Protocol has not proved their testnet usage by providing the addresses

Security

85%

This section looks at the 3rd party software audits done. It is explained in this document.

16. Is the protocol sufficiently audited? (%)

Answer: 90%

While Peckshield's V2 version seems to be the most recent audit available, there are only 1 audit performed before deployment of the current version of InstaDapp. The other audits such as Samczsun's do not provide enough information to confirm subsantial auditing. Because of Peckshield's audits and OpenZeppelin Security, the protocol earns a 90% on this question.

Percentage Score Guidance:
100%
Multiple Audits performed before deployment and the audit findings are public and implemented or not required
90%
Single audit performed before deployment and audit findings are public and implemented or not required
70%
Audit(s) performed after deployment and no changes required. The Audit report is public.
65%
Code is forked from an already audited protocol and a changelog is provided explaining why forked code was used and what changes were made. This changelog must justify why the changes made do not affect the audit.
50%
Audit(s) performed after deployment and changes are needed but not implemented.
30%
Audit(s) performed are low-quality and do not indicate proper due diligence.
20%
No audit performed
0%
Audit Performed after deployment, existence is public, report is not public OR smart contract address' not found.
Deduct 25% if the audited code is not available for comparison.

17. Is the bounty value acceptably high (%)

Answer: 50%

An active bug bounty of 50K can be found under InstaDapp on Immunefi's website/

Percentage Score Guidance:
100%
Bounty is 10% TVL or at least $1M AND active program (see below)
90%
Bounty is 5% TVL or at least 500k AND active program
80%
Bounty is 5% TVL or at least 500k
70%
Bounty is 100k or over AND active program
60%
Bounty is 100k or over
50%
Bounty is 50k or over AND active program
40%
Bounty is 50k or over
20%
Bug bounty program bounty is less than 50k
0%
No bug bounty program offered / the bug bounty program is dead
An active program means that a third party (such as Immunefi) is actively driving hackers to the site. An inactive program would be static mentions on the docs.

Admin Controls

71%

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?

Answer: 100%

Admin control information can be found under the "Governance" section in the footer of the webpage.

Percentage Score Guidance:
100%
Admin Controls are clearly labelled and on website, docs or repo, quick to find
70%
Admin Controls are clearly labelled and on website, docs or repo but takes a bit of looking
40%
Admin Control docs are in multiple places and not well labelled
20%
Admin Control docs are in multiple places and not labelled
0%
Admin Control information could not be found

19. Are relevant contracts clearly labelled as upgradeable or immutable? (%)

Answer: 100%

InstaDapp clearly labels the protocol's functionalities as being upgradeable in the Introduction section here.

Percentage Score Guidance:
100%
Both the contract documentation and the smart contract code state that the code is not upgradeable or immutable.
80%
All Contracts are clearly labelled as upgradeable (or not)
50%
Code is immutable but not mentioned anywhere in the documentation
0%
Admin control information could not be found

20. Is the type of smart contract ownership clearly indicated? (%)

Answer: 100%

Ownership is indicated as OnlyOwner for dsa-contracts in the code and governance proposals are set as MultiSig in their documentation.

Percentage Score Guidance:
100%
The type of ownership is clearly indicated in their documentation. (OnlyOwner / MultiSig / etc)
50%
The type of ownership is indicated, but only in the code. (OnlyOwner / MultiSig / etc)
0%
Admin Control information could not be found

21. Are the protocol's smart contract change capabilities described? (%)

Answer: 0%

The smart contract change capabilities are not covered by the documentation, there is only mention of the upgradeability with no specification.

Percentage Score Guidance:
100%
The documentation covers the capabilities for change for all smart contracts
50%
The documentation covers the capabilities for change in some, but not all contracts
0%
The documentation does not cover the capabilities for change in any contract

22. Is the protocol's admin control information easy to understand? (%)

Answer: 100%

The admin control information regarding upgradeability and governance are easy to understand.

Percentage Score Guidance:
100%
All the contracts are immutable
90%
Description relates to investments safety in clear non-software language
30%
Description all in software-specific language
0%
No admin control information could be found

23. Is there sufficient Pause Control documentation? (%)

Answer: 0%

There is no Pause Control documentation available on the developer documentation

Percentage Score Guidance:
100%
If immutable and no changes possible
100%
If admin control is fully via governance
80%
Robust transaction signing process (7 or more elements)
70%
Adequate transaction signing process (5 or more elements)
60%
Weak transaction signing process (3 or more elements)
0%
No transaction signing process evident
Evidence of audits of signers following the process add 20%

24. Is there sufficient Timelock documentation? (%)

Answer: 60%

The protocol identifies a timelock and a duration of 10 days in their timelock.sol contract

Percentage Score Guidance:
100%
Documentation identifies and explains why the protocol does not need a Timelock OR Timelock documentation identifies its duration, which contracts it applies to and justifies this time period.
60%
A Timelock is identified and its duration is specified
30%
A Timelock is identified
0%
No Timelock information was documented

25. Is the Timelock of an adequate length? (Y/N)

Answer: 100%

As specified here, the timelock is a minimum of 2 days to a maximum of 30 days, which is well above the appropriate length.

Percentage Score Guidance:
100%
Timelock is between 48 hours to 1 week OR justification as to why no Timelock is needed / is outside this length.
50%
Timelock is less than 48 hours or greater than 1 week.
0%
No Timelock information was documented OR no timelock length was identified.

Oracles

100%

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. These questions are explained in this document.

26. Is the protocol's Oracle sufficiently documented? (%)

Answer: 100

InstaDapp explains why their Smart Wallet service is not susceptible to oracle attacks.

Score Guidance:
100%
If it uses one, the Oracle is specified. The contracts dependent on the oracle are identified. Basic software functions are identified (if the protocol provides its own price feed data). Timeframe of price feeds are identified. OR The reason as to why the protocol does not use an Oracle is identified and explained.
75%
The Oracle documentation identifies both source and timeframe, but does not provide additional context regarding smart contracts.
50%
Only the Oracle source is identified.
0%
No oracle is named / no oracle information is documented.

27. Is front running mitigated by this protocol? (Y/N)

Answer: Yes

InstaDapp escribes why the Smart wallet is not vulnerable to front running attacks here.

Score Guidance:
Yes
The protocol cannot be front run and there is an explanation as to why OR documented front running countermeasures are implemented.
No
The Oracle documentation identifies both source and timeframe, but does not provide additional context regarding smart contracts.

28. Can flashloan attacks be applied to the protocol, and if so, are those flashloan attack risks mitigated? (Y/N)

Answer: Yes

InstaDapp offers a flash loan functionality and describes why the Smart wallet is not vulnerable to flash loan attacks here.

Score Guidance:
Yes
The protocol's documentation includes information on how they mitigate the possibilities and extents of flash loan attacks.
No
The protocol's documentation does not include any information regarding the mitigation of flash loan attacks.

Appendices

null
1pragma solidity ^0.7.0;
2pragma experimental ABIEncoderV2;
3
4/**
5 * @title InstaIndex
6 * @dev Main Contract For DeFi Smart Accounts. This is also a factory contract, Which deploys new Smart Account.
7 * Also Registry for DeFi Smart Accounts.
8 */
9
10interface AccountInterface {
11    function version() external view returns (uint);
12    function enable(address authority) external;
13    function cast(address[] calldata _targets, bytes[] calldata _datas, address _origin) external payable returns (bytes32[] memory responses);
14}
15
16interface ListInterface {
17    function init(address _account) external;
18}
19
20contract AddressIndex {
21
22    event LogNewMaster(address indexed master);
23    event LogUpdateMaster(address indexed master);
24    event LogNewCheck(uint indexed accountVersion, address indexed check);
25    event LogNewAccount(address indexed _newAccount, address indexed _connectors, address indexed _check);
26
27    // New Master Address.
28    address private newMaster;
29    // Master Address.
30    address public master;
31    // List Registry Address.
32    address public list;
33
34    // Connectors Modules(Account Module Version => Connectors Registry Module Address).
35    mapping (uint => address) public connectors;
36    // Check Modules(Account Module Version => Check Module Address).
37    mapping (uint => address) public check;
38    // Account Modules(Account Module Version => Account Module Address).
39    mapping (uint => address) public account;
40    // Version Count of Account Modules.
41    uint public versionCount;
42
43    /**
44    * @dev Throws if the sender not is Master Address.
45    */
46    modifier isMaster() {
47        require(msg.sender == master, "not-master");
48        _;
49    }
50
51    /**
52     * @dev Change the Master Address.
53     * @param _newMaster New Master Address.
54     */
55    function changeMaster(address _newMaster) external isMaster {
56        require(_newMaster != master, "already-a-master");
57        require(_newMaster != address(0), "not-valid-address");
58        require(newMaster != _newMaster, "already-a-new-master");
59        newMaster = _newMaster;
60        emit LogNewMaster(_newMaster);
61    }
62
63    function updateMaster() external {
64        require(newMaster != address(0), "not-valid-address");
65        require(msg.sender == newMaster, "not-master");
66        master = newMaster;
67        newMaster = address(0);
68        emit LogUpdateMaster(master);
69    }
70
71    /**
72     * @dev Change the Check Address of a specific Account Module version.
73     * @param accountVersion Account Module version.
74     * @param _newCheck The New Check Address.
75     */
76    function changeCheck(uint accountVersion, address _newCheck) external isMaster {
77        require(_newCheck != check[accountVersion], "already-a-check");
78        check[accountVersion] = _newCheck;
79        emit LogNewCheck(accountVersion, _newCheck);
80    }
81
82    /**
83     * @dev Add New Account Module.
84     * @param _newAccount The New Account Module Address.
85     * @param _connectors Connectors Registry Module Address.
86     * @param _check Check Module Address.
87     */
88    function addNewAccount(address _newAccount, address _connectors, address _check) external isMaster {
89        require(_newAccount != address(0), "not-valid-address");
90        versionCount++;
91        require(AccountInterface(_newAccount).version() == versionCount, "not-valid-version");
92        account[versionCount] = _newAccount;
93        if (_connectors != address(0)) connectors[versionCount] = _connectors;
94        if (_check != address(0)) check[versionCount] = _check;
95        emit LogNewAccount(_newAccount, _connectors, _check);
96    }
97
98}
99
100contract CloneFactory is AddressIndex {
101    /**
102     * @dev Clone a new Account Module.
103     * @param version Account Module version to clone.
104     */
105    function createClone(uint version) internal returns (address result) {
106        bytes20 targetBytes = bytes20(account[version]);
107        // solium-disable-next-line security/no-inline-assembly
108        assembly {
109            let clone := mload(0x40)
110            mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
111            mstore(add(clone, 0x14), targetBytes)
112            mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
113            result := create(0, clone, 0x37)
114        }
115    }
116
117    /**
118     * @dev Check if Account Module is a clone.
119     * @param version Account Module version.
120     * @param query Account Module Address.
121     */
122    function isClone(uint version, address query) external view returns (bool result) {
123        bytes20 targetBytes = bytes20(account[version]);
124        // solium-disable-next-line security/no-inline-assembly
125        assembly {
126            let clone := mload(0x40)
127            mstore(clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000)
128            mstore(add(clone, 0xa), targetBytes)
129            mstore(add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
130
131            let other := add(clone, 0x40)
132            extcodecopy(query, other, 0, 0x2d)
133            result := and(
134                eq(mload(clone), mload(other)),
135                eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))
136            )
137        }
138    }
139}
140
141contract InstaIndex is CloneFactory {
142
143    event LogAccountCreated(address sender, address indexed owner, address indexed account, address indexed origin);
144
145    /**
146     * @dev Create a new DeFi Smart Account for a user and run cast function in the new Smart Account.
147     * @param _owner Owner of the Smart Account.
148     * @param accountVersion Account Module version.
149     * @param _targets Array of Target to run cast function.
150     * @param _datas Array of Data(callData) to run cast function.
151     * @param _origin Where Smart Account is created.
152     */
153    function buildWithCast(
154        address _owner,
155        uint accountVersion,
156        address[] calldata _targets,
157        bytes[] calldata _datas,
158        address _origin
159    ) external payable returns (address _account) {
160        _account = build(_owner, accountVersion, _origin);
161        if (_targets.length > 0) AccountInterface(_account).cast{value: msg.value}(_targets, _datas, _origin);
162    }
163
164    /**
165     * @dev Create a new DeFi Smart Account for a user.
166     * @param _owner Owner of the Smart Account.
167     * @param accountVersion Account Module version.
168     * @param _origin Where Smart Account is created.
169     */
170    function build(
171        address _owner,
172        uint accountVersion,
173        address _origin
174    ) public returns (address _account) {
175        require(accountVersion != 0 && accountVersion <= versionCount, "not-valid-account");
176        _account = createClone(accountVersion);
177        ListInterface(list).init(_account);
178        AccountInterface(_account).enable(_owner);
179        emit LogAccountCreated(msg.sender, _owner, _account, _origin);
180    }
181
182    /**
183     * @dev Setup Initial things for InstaIndex, after its been deployed and can be only run once.
184     * @param _master The Master Address.
185     * @param _list The List Address.
186     * @param _account The Account Module Address.
187     * @param _connectors The Connectors Registry Module Address.
188     */
189    function setBasics(
190        address _master,
191        address _list,
192        address _account,
193        address _connectors
194    ) external {
195        require(
196            master == address(0) &&
197            list == address(0) &&
198            account[1] == address(0) &&
199            connectors[1] == address(0) &&
200            versionCount == 0,
201            "already-defined"
202        );
203        master = _master;
204        list = _list;
205        versionCount++;
206        account[versionCount] = _account;
207        connectors[versionCount] = _connectors;
208    }
209
210}

JavaScript Tests

Language
Files
Lines
Blanks
Comments
Testing Code
Deployed Code
Complexity
Typescript
3
3012
328
19
2665
885
129
Javascript
11
1242
210
215
817
885
0
Total
14
4254
538
234
3482
1770
129

Tests to Code: 3482 / 885 = 393 %