CertiK reviewed Ancient Raid (Ancient Raid - Audit) on 19 Oct 2022: 17 findings, 0 critical; 12 marked fixed, 5 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 | 3 | 0 | 1 |
| Medium | 0 | 0 | 0 |
| Low | 2 | 0 | 11 |
When updating the codes to remove the usage of the `SafeMath` library, the **linked** updated formula is inconsistent with the original commit [7805cec29a5f0c2621aedde854900d77180e8189](https://github.com/ancient-raid/contracts/tree/7805cec29a5f0c2621aedde854900d77180e8189). In the original commit 7805cec29a5f0c2621aedde854900d77180e8189, the calculation of `denominator` is shown as below: ```solidity uint256 denominator = reserveOut.sub(amountOut).mul(998); ``` However, the implementation of the current commit cfa0b7e8d196ae71df0ba2a403a7f189114bbbbf is : ```solidity uint256 denominator = (reserveOut/amountOut)*998; ```
In the `_transfer()` function, if the `recipient` is `uniswapV2PairAddress` and `sender` is not `mainWallte`, the contract will take a fee from the transfer and the amount received by the `receiver` is 90% of the original transfer amount. However, in this case, the `Transfer()` event still uses the original amount as the corresponding parameter.
The body of the linked external function `mint()` is empty, which seems inconsistent with the comment: "@dev Mint game rewards without exceeding token supply cap".
The functions which are never called internally within the contract should have external visibility for gas optimization. ```solidity=1126 function renounceOwnership() public virtual onlyOwner { ``` --- ```solidity=1134 function transferOwnership(address newOwner) public virtual onlyOwner { ``` --- ```solidity=2144 function getRoleMember(bytes32 role, uint256 index) ``` --- ```solidity=2157 function getRoleMemberCount(bytes32 role) ``` --- ```solidity=2531 function name() public view virtual override returns (string memory) { ``` --- ```solidity=2539 function symbol() public view virtual override returns (string memory) { ``` --- ```solidity=2556 function decimals() public view virtual override returns (uint8) { ``` --- ```solidity=2563 function totalSupply() public view virtual override returns (uint256) { ``` --- ```solidity=2618 function approve(address spender, uint256 amount) ``` --- ```solidity=3498 function updateMaster(address newMaster) public onlyMaster { ``` --- ```solidity=3502 function udpateUniswapV2Pair(address _UniswapV2PairAddress) ``` --- ```solidity=3509 function udpateTransfer(bool _is) public onlyOwner { ``` --- ```solidity=3513 function udpateMainWallteAndOth( ``` --- ```solidity=3521 function initialize() public initializer { ``` --- ```solidity=3605 function cap() public view override returns (uint256) { ``` --- ```solidity=3631 function pause() public override onlyRole(CryptoGodzStructs.PAUSER_ROLE) { ``` --- ```solidity=3638 function unpause() public override onlyRole(CryptoGodzStructs.PAUSER_ROLE) { ```
The abstract contract `PausableUpgradeable` has no `public` or `external` functions to pause/unpause the contract, and the `RaidContract` contract does not implement these two features either. However, the `whenNotPaused()` modifier is used in the functionality of transfer. If the `_paused` state variable cannot be changed, the functionality associated with `PausableUpgradeable` is incomplete.
There should always be events emitted in the sensitive functions that are controlled by centralization roles.
In the `_transfer()` function, the `Transfer` event is not emitted when not taking the fee from the transfer.
The **require** can be used to check for conditions and throw an exception if the condition is not met. It is better to provide a string message containing details about the error that will be passed back to the caller.
The given input is missing the check for the non-zero address. ```solidity function udpateMainWallte( address _mainWallte, address _zhiWallte, address _rewardWallte ) internal virtual { mainWallte = _mainWallte; zhiWallte = _zhiWallte; rewardWallte = _rewardWallte; } ``` These accounts are used to receive the fee when transferring to the `uniswapV2PairAddress`. Thus, missing the check for a non-zero address may cause the loss of the token.
The `RaidContract` takes fees from the transfer to `uniswapV2PairAddress`. It is noticed that the contract uses multiplication to calculate the corresponding amount of these four accounts: `recipient`, `mainWallte`, `zhiWallte`, `rewardWallte`. If the transfer amount is not divisible by 100, it may cause a small loss of precision and the loss of the token. For example: ```solidity uint amount = 1001; uint a = amount*90/100; // 900 uint b = amount*7/100; // 70 uint c = amount*2/100; // 20 uint d = amount*1/100; // 10 require(amount == a+b+c+d); // it is false, revert ```
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=3191 library SafeMath { ``` - An implementation of `SafeMath` library is found. --- ```solidity=3323 using SafeMath for uint256; ``` - `SafeMath` library is used for `uint256` type in `PancakeLibrary` contract. ```solidity=3386 amountB = amountA.mul(reserveB) / reserveA; ``` - `SafeMath.mul` is called in `quote` function of `PancakeLibrary` contract. *Note: Only a sample of 2 `SafeMath` library usage in this contract (out of 11) are shown above.*
In the contract `RaidContract`, there are two **private** storage variables that seem useless in the business logic. - `_cap`: It should be used to cap the token mint. Although this variable is assigned, it is never used in functions such as `mint()` or `burn()` ; - `master`: This mapping variable is used in the modifier `onlyMaster()`, which is only used in the `updateMaster()` function. Please check if the implementation meets the design.
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (2)
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