Vidma is pleased to present this audit report outlining our assessment of code, smart contracts, and other important audit insights and suggestions for management, developers, and users.
EG implemented the migration mechanism that allows holders to update their old tokens for new ones when the project upgrades to a new contract on the EVM chain. It helps projects with contract upgrades, supply consolidations, mergers/acquisitions etc.
An audited contract allows adding the token with consolidation ratio to be supported on the platform, doing the actual migration and token exchange with selected amount of coins, updating data of supported migration token, disable this token, refunding non-migrated tokens to the project team by owner. Also, the contract has ownership functionality to limit user access to the admin functions and transfer control to another address.
During the audit process, the Vidma team found several issues. A detailed summary and the current state are displayed in the table below.
After evaluating the findings in this report and the final state after fixes, the Vidma auditors can state that the contracts are fully operational and secure. Under the given circumstances, we set the following risk level:
To set the codebase quality mark, our auditors are evaluating the initial commit given for the scope of the audit and the last commit with the fixes. This approach helps us adequately and sequentially evaluate the quality of the code. Code style, optimization of the contracts, the number of issues, and risk level of the issues are all taken into consideration. The Vidma team has developed a transparent evaluation codebase quality system presented below.
Evaluating the initial commit and the last commit with the fixes, Vidma audit team set the following codebase quality mark.
Score
Based on the overall result of the audit and the state of the final reviewed commit, the Vidma audit team grants the following score:
In addition to manual check and static analysis, the auditing team has conducted a number of integrated autotests to ensure the given codebase has an adequate performance and security level. The test results and coverage can be found in the accompanying section of this audit report.
Please be aware that this audit does not certify the definitive reliability and security level of the contract. This document describes all vulnerabilities, typos, performance issues, and security issues found by the Vidma audit team.
If the code is still under development, we highly recommend running one more audit once the code is finalized.
EGMigrate mission is to leverage community action and blockchain technologies to grow a global movement that defies the status quo and makes profitability intrinsically linked to positive social impact.
Within the scope of this audit, two independent auditors thoroughly investigated the given codebase and analyzed the overall security and performance of the smart contracts.
The audit was conducted from January 10, 2023 to January 12, 2023. The review of the fixes was conducted from January 16, 2023 to January 17, 2023. The latest commit was reviewed and approved on January 25, 2023. The outcome is disclosed in this document.
The scope of work for the given audit consists of the following contract:
The source code was taken from the following source:
https://github.com/EG-Ecosystem/eg-migrate
Initial commit submitted for the audit:
5f92aa1ef2a6bc151317a4ccdf55e70e6e6b26d8
Last commit reviewed by the auditing team:
Vidma audit team uses the most sophisticated and contemporary methods and well-developed techniques to ensure contracts are free of vulnerabilities and security risks. The overall workflow consists of the following phases:
After the Audit kick-off, our security team conducts research on the contract’s logic and expected behavior of the audited contract.
Vidma auditors do a deep dive into your tech documentation with the aim of discovering all the behavior patterns of your codebase and analyzing the potential audit and testing scenarios.
At this point, the Vidma auditors are ready to kick off the process. We set the auditing strategies and methods and are prepared to conduct the first audit part.
During the manual phase of the audit, the Vidma team manually looks through the code in order to find any security issues, typos, or discrepancies with the logic of the contract. The initial commit as stated in the agreement is taken into consideration.
Static analysis tools are used to find any other vulnerabilities in smart contracts that were missed after a manual check.
An interim report with the list of issues.
Within the testing part, Vidma auditors run integration tests using the Truffle or Hardhat testing framework. The test coverage and the test results are inserted in the accompanying section of this audit report.
Second interim report with the list of new issues found during the testing part of the audit process.
For simplicity in reviewing the findings in this report, Vidma auditors classify the findings in accordance with the severity level of the issues. (from most critical to least critical).
All issues are marked as “Resolved” or “Unresolved”, depending on if they have been fixed by project team or not. The issues with “Not Relevant” status are left on the list of findings but are not eligible for the score points deduction.
The latest commit with the fixes reviewed by the auditors is indicated in the “Scope of Work” section of the report.
The Vidma team always provides a detailed description of the issues and recommendations on how to fix them.
Classification of found issues is graded according to 6 levels of severity described below:
Low ML – 01 | Resolved
OwnableUpgradeable smart contract is a modified version of openzeppelin standard contract (renounceOwnership() function removed). There is transferOwnership() function that is not called in the contract itself so its visibility can be improved from public to external.
Consider changing visibility from public to external to safe gas usage on calling this function.
Low ML – 02 | Resolved
In EGMigrate smart contract could be used _msgSender() function instead of msg.sender because it is inherited from ContextUpgradeable smart contract. In addition, the _msgSender() function call requires less gas than msg.sender.
Consider changing msg.sender to _msgSender().
Low ML – 03 | Resolved
Imports of IERC20 and ERC20 could be replaced by import of IERC20Metadata that already includes the IERC20 interface and does not contain unnecessary functionality of ERC20 smart contract.
Consider changing imports:
to:
Also change ERC20 type usage to IERC20Metadata for decimals() calls.
Low ML – 04 | Resolved
In migrate() function of EGMigrate smart contract there is storing Migration to _userMigrations of _msgSender() but toAddress is not stored:
Change toAddress: _msgSender() to toAddress: toAddress.
Low TL – 01 | Resolved
The functions addMigrationToken() and updateMigrationTokenInfo() are not provided with input parameters validation of sourceToken and targetToken parameters, can be passed the same addresses for source and target tokens.
Consider adding next require statement (require(sourceToken != targetToken)).
Low TL – 02 | Resolved
The function returnTokens() isn’t provided with validation amount tokens to transfer, contract balance of target token can be less than the passed amount which will lead to an error in transfer function.
Consider adding require for check contract balance of target token (require(amount => IERC20(migrationToken.targetToken).balanceOf(address(this))).
Informational MI – 01 | Resolved
Usually, one source file contains one smart contract. OwnableUpgradeable smart contract implements a module of certain functionality and can be placed in an independent source file.
Consider moving OwnableUpgradeable smart contract to separate source file.
Informational MI – 02 | Resolved
NatSpec comments are missed before EGMigrate smart contract declaration and initialize() function. A public state variable is equivalent to a function for the purposes of NatSpec. Events also need NatSpec notations.
Consider adding NatSpec for EGMigrate SC, initialize() function and events. Also, change comments of public variables to NatSpec comments. View NatSpec Format — Solidity 0.8.17 documentation.
Informational MI – 03 | Resolved
Private and internal state variable names should use underscore and mixedCase (_initialSupply, _account, _recipientAddress etc).View Style Guide — Solidity 0.8.17 documentation.
Consider changing userMigrations to _userMigrations.
To verify the security of contracts and the performance, a number of integration tests were carried out using the Hardhat testing framework.
In this section, we provide both tests written by EG and tests written by Vidma auditors.
EG Coverage – 100%
Vidma Coverage – 100%
Industry Standard – 95%
It is important to note that Vidma auditors do not modify, edit or add tests to the existing tests provided in the EG repository. We write totally separate tests with code coverage of a minimum of 95% to meet the industry standards.
We are delighted to have a chance to work with the EG team and contribute to your company's success by reviewing and certifying the security of your smart contracts.
The statements made in this document should be interpreted neither as investment or legal advice, nor should its authors be held accountable for decisions made based on this document.