CertiK reviewed EgoCoin (EGO) on 4 May 2023: 19 findings, 0 critical; 7 marked fixed, 4 acknowledged, 8 open.
Report hosted on skynet.certik.com.
Trustblock does not review code.
Statuses are the security firm’s own, from its report.
| Severity | Open | Acknowledged | Fixed |
|---|---|---|---|
| Critical | 0 | 0 | 0 |
| High | 0 | 3 | 1 |
| Medium | 0 | 1 | 0 |
| Low | 8 | 0 | 6 |
A reentrancy attack can occur when the contract creates a function that makes an external call to another untrusted contract before resolving any effects. If the attacker can control the untrusted contract, they can make a recursive call back to the original function, repeating interactions that would have otherwise not run after the external call resolved the effects. ### External call(s) ```solidity=142 IERC20(tokenAddress).safeTransfer(msg.sender, totalAmount); ``` ### State variables written after the call(s) ```solidity=144 account.amountStake -= _amount; ``` ```solidity=146 account.missedReward = tokenPerStake * account.amountStake; ``` ```solidity=149 totalAmountStake -= _amount; ``` --- ### External call(s) ```solidity=164 IERC20(tokenAddress).safeTransfer(msg.sender, amount); ``` ### State variables written after the call(s) ```solidity=165 account.missedReward += amount * precision; ```
The comment says "Mint initial supply to polygon", but the `block.chainid` of 80001 corresponds to the Mumbai testnet.
When transferring deflationary ERC20 tokens, the input amount may not be equal to the received amount due to the charged transaction fee. For example, if a user sends 100 deflationary tokens (with a 10% transaction fee), only 90 tokens actually arrived to the contract. However, a failure to discount such fees may allow the same user to withdraw 100 tokens from the contract, which causes the contract to lose 10 tokens in such a transaction. Reference: https://thoreum-finance.medium.com/what-exploit-happened-today-for-gocerberus-and-garuda-also-for-lokum-ybear-piggy-caramelswap-3943ee23a39f ```solidity=110 IERC20(tokenAddress).safeTransferFrom(msg.sender, address(this), _amount); ``` - Transferring tokens by `_amount`. ```solidity=120 totalAmountStake += _amount; ``` - The `_amount` appears to be used for bookkeeping purposes without compensating the potential transfer fees.
In the contract `StakingSample.sol`, rewards are distributed in the same `tokenAddress` token used to stake. If the owner does not deposit extra rewards tokens into the contract, then rewards will be paid from other users' deposits.
The variable re-assignment below is considered redundant in the contract. ```sol=168 uint256 secondsPerSlice = vestingSlicePeriodSeconds; ```
State variables that never change should be declared as `constant` to save gas. ```solidity=40 uint256 public vestingSlicePeriodSeconds = 60; ``` - `vestingSlicePeriodSeconds` should be declared `constant`.
The `SafeMath` library is used unnecessarily. With Solidity compiler versions 0.8.0 or newer, arithmetic operations will automatically revert in case of integer overflow or underflow. ```solidity=14 using SafeMath for uint256; ``` - `SafeMath` library is used for `uint256` type in `Vesting` contract. ```solidity=161 return totalAmountOfUser .mul((100 - startVestingPercentage)) .div(100) .sub(userAddressToAmountClaimed[_account]); ``` - `SafeMath.mul` is called in `_computeReleasableAmount` function of `Vesting` contract. *Note: Only a sample of 2 `SafeMath` library usage in this contract (out of 17) are shown above.*
The linked variables assigned in the constructor can be declared as `immutable`. Immutable state variables can be assigned during contract creation but will remain constant throughout the lifetime of a deployed contract. A big advantage of immutable variables is that reading them is significantly cheaper than reading from regular state variables since they will not be stored in storage.
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (4)
1,044 projects reviewed · 1,375 reports · latest May 2025
See CertiK’s auditsSomething wrong on this page? A missing report, a wrong date, a finding that was fixed since. Tell us and we check it against its source.
Tell us