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 is a community token that powers the EG Ecosystem.The EG Smart Contract accumulates a 5% fee from every Buy and a 5% fee from every Sell transaction. No fee is collected from transfers in default setting but all fee is configurable and can be changed by the owner. All fee is accumulated in the Smart Contract.
The fee is then distributed to community-governed wallets and used for tech development, holder rewards, and EG's massive social impact initiatives around the world.
Smart Contract supports 5 wallet addresses: Marketing, Liquidity, Tech, Donations, and Staking Rewards. The owner has the ability to change a percentage amount for each wallet. The owner can call "withdrawTokens()" to remove tokens accumulated in the contract. These tokens are sent to all 5 wallets, based on the configured percentages.
There are whitelisted and blacklisted wallets in the EG token. Whitelisted wallets do not pay a fee on Buy or Sell. Blacklisted wallets cannot trade but can only transfer tokens to EG token contract owner. All holders are not whitelisted by default and pay a fee. For transfers, if one or both wallets are whitelisted, no fee is paid. The fee is only paid on transfer if none of the wallets is whitelisted.
The EG token contract implements Anti-rug protection and Anti-Bot Protection. Only the owner can create a liquidity pool. Trading will not actually be enabled for several minutes after the “enable trading function" is called. Max transaction amount will be some percentage of the supply, which can be confirmed by the maxTransactionCoolDownAmount function.
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.
EG’s 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 December 2, 2022 to December 9, 2022. The outcome is disclosed in this document. The review of the fixes was conducted from December 13, 2022 to December 14, 2022.
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-token/blob/main/EGToken.sol
Initial commit submitted for the audit:
36376c7cdefb86cba579b170a34476a48b903d26
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:
Medium MM – 01 | Resolved
According to the documentation, the EG contract should be upgradable but simple non-upgradable contract libraries from openzeppelin are used.
Also valid in function claimable when block.timestamp == vestingTime.
Consider using Ownable, Context, IERC20 contracts from upgradable contract package by openzeppelin: @openzeppelin/contracts-upgradable
Medium MM – 02 | Resolved
Function withdrawAlienTokens() ignores return value by token transfer at L1102.
Consider using SafeERC20, to ensure that the transfer return value is checked, as the contract is designed to support different tokens using the SafeERC20 library will help safely operate with non-standard tokens which don’t have return value on transfers.
Medium MM – 03 | Resolved
Due to a requirement of the proxy-based upgradeability system, no constructors can be used in upgradeable contracts.
Consider removing the constructor from the EG contract.
Low ML – 01 | Resolved
The current version of solc in contract EG is ^0.8.9 and it is better to lock the pragma to a specific version.
Contracts should be deployed with the same compiler version and flags they have tested thoroughly. Locking the pragma helps to ensure that contracts do not accidentally get deployed using, for example, an outdated compiler version that might introduce bugs that affect the contract system negatively.
Lock pragma to a specific version.
Low ML – 02 | Resolved
Starting from 0.8.0 solc compiler has implemented checks for overflows and underflows, so there is no need for use of SafeMath for arithmetic operations.
Consider removing SafeMath usage to decrease bytecode and gas usage.
Low ML – 03 | Resolved
In the contract EG there is shadowing of the state variable owner in the function EG.allowance() which is also defined in the inherited contract ERC20Upgradeable.
Consider renaming the local variables that shadow another component.
Low ML – 04 | Resolved
There is a comparison to the boolean constant in the functions EG.inTokenCheck(), and EG.tokenCheck().
Avoid comparing boolean expressions to boolean literals to decrease gas usage for the function call and deployment.
Straight comparison of the bool type is more gas efficient than comparing uint8 or boolean constant. For example:
Low ML – 05 | Unresolved
There is the usage of the tx.origin to influence a control flow decision. Note that using tx.origin for authentication leaves the contract vulnerable to a phishing-like attack. It is recommended to use msg.sender instead.
Avoid using tx.origin for authentication.
The EG team uses a multi-signature wallet to manage the owner wallet and admin related functions.
Informational MI – 01 | Resolved
It is best practice to set the visibility of state variables explicitly. The default visibility for balances, _allowances, lastTransfer in the contract EG (L138, L140, L149) is internal.
Explicitly specify the visibility of state variables.
To verify the security of contracts and their performance, a number of integration tests were carried out using the Hadrhat testing framework.
In this section, we provide both tests written by EG and tests written by Vidma auditors.
EG Coverage – 89.74%
Vidma Coverage – 98.44%
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 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.