CertiK reviewed Cryptolegions (Crypto Legions - Addendum Ⅱ) on 19 Sep 2022: 49 findings, 0 critical; 17 marked fixed, 13 acknowledged, 19 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 | 12 | 6 |
| Medium | 0 | 1 | 1 |
| Low | 19 | 0 | 10 |
Boolean constants can be used directly and do not need to be compared to true or false. ```solidity=146 require( checkCoolDownTime(tokenId) == true, 'Should not transfer legion during 30 days after previous tranfer' ); ``` --- ```solidity=236 require(isSunday() == true, '10'); ``` --- ```solidity=238 require(avail == true, '11'); ``` --- ```solidity=240 require(canHunt(tokenId) == true, '12'); ``` --- ```solidity=257 require(canHunt(tokenId) == true, '12'); ``` --- ```solidity=288 require(isSunday() == true, '17'); ``` --- ```solidity=290 require(avail == true, '18'); ``` --- ```solidity=119 uint8 length = isSunday() == true ? 25 : 24; ```
There are many hardcode addresses in this codebase.
There should always be events emitted in the sensitive functions that are controlled by centralization roles.
Addresses should be checked before assignment or external call to make sure they are not zero addresses. ```solidity=201 marketplace = _addr; ``` - `_addr` is not zero-checked before being used. --- ```solidity=54 warriorNFTAddress = warrior; ``` - `warrior` is not zero-checked before being used. --- ```solidity=260 beast = _beast; ``` - `_beast` is not zero-checked before being used. --- ```solidity=261 warrior = _warrior; ``` - `_warrior` is not zero-checked before being used. --- ```solidity=262 legion = _legion; ``` - `_legion` is not zero-checked before being used. --- ```solidity=263 marketplace = _marketplace; ``` - `_marketplace` is not zero-checked before being used.
The linked variables are assigned only once, either during their contract-level declaration or during the `constructor`'s execution.
The state variable `automatedMarketMakerPairs` may contain more than one Uniswap pair except for `lpPair`. So whether or not the pairs, except for `lpPair`, can be excluded from the max transaction by calling the function `excludeFromMaxTransaction()`?
A sandwich attack might happen when an attacker observes a transaction swapping tokens or adding liquidity without setting restrictions on the slippage or minimum output amount. The attacker can manipulate the exchange rate by front running (before the transaction is attacked) a transaction to purchase one of the assets and make profits by back running (after the transaction is attacked) a transaction to sell the asset. The following functions are called without setting restrictions on slippage or minimum output amount, so transactions triggering these functions are vulnerable to sandwich attacks, especially when the input amount is large: - `swapBack()`
The linked function `approveBlst()` is called only by the contract `RewardPool` itself and only within the `setApproveToContracts()` function defined in `RewardPool.sol`. So the `approveBlst()` should be defined as internal function.
The linked statements do not affect the functionality of the codebase and appear to be either leftovers from test code or older functionality.
Comparisons that are always true or always false may be incorrect or unnecessary. ```solidity=111 require(_index >= 0 && _index < 8, 'Unknown fee type'); ```
The contract is serving as the underlying entity to interact with one or more third party protocols. The scope of the audit treats third party entities as black boxes and assume their functional correctness. However, in the real world, third parties can be compromised and this may lead to lost or stolen assets. In addition, upgrades of third parties can possibly create severe impacts, such as increasing fees of third parties, migrating to new LP pools, etc. ```solidity=10 IMarketPlace private constant oldMarketPlace = IMarketPlace(0x2D9446738C60338e5a6D0416108217B460d6D266); ``` - The contract `BeastNFT` interacts with third party contract with `IMarketPlace` interface via `oldMarketPlace`. --- ```solidity=18 IERC20 public bloodstone; ``` - The contract `CommonNFT` interacts with third party contract with `IERC20` interface via `bloodstone`. --- ```solidity=27 IVRFConsumer vrfConsumer; ``` - The contract `CommonNFT` interacts with third party contract with `IVRFConsumer` interface via `vrfConsumer`. --- ```solidity=98 IDEXRouter public router; ``` - The contract `FeeHandler` interacts with third party contract with `IDEXRouter` interface via `router`. --- ```solidity=18 IMarketPlace private constant oldMarketPlace = IMarketPlace(0x2D9446738C60338e5a6D0416108217B460d6D266); ``` - The contract `LegionNFT` interacts with third party contract with `IMarketPlace` interface via `oldMarketPlace`. --- ```solidity=23 IERC20 public BUSD = IERC20(0x78867BbEeF44f2326bF8DDd1941a4439382EF2A7); ``` - The contract `LegionNFT` interacts with third party contract with `IERC20` interface via `BUSD`. --- ```solidity=25 IUniswapV2Pair pair = IUniswapV2Pair(0xF7349a1d58e17A3dbf54ab8Fb30FB8F56D2eb700); // Should update it from Tris ``` - The contract `LegionNFT` interacts with third party contract with `IUniswapV2Pair` interface via `pair`. --- ```solidity=17 IERC20 private bloodstone; ``` - The contract `Marketplace` interacts with third party contract with `IERC20` interface via `bloodstone`. --- ```solidity=9 IERC20 private bloodstone; ``` - The contract `RewardPool` interacts with third party contract with `IERC20` interface via `bloodstone`. --- ```solidity=9 VRFCoordinatorV2Interface COORDINATOR; ``` - The contract `VRFv2Consumer` interacts with third party contract with `VRFCoordinatorV2Interface` interface via `COORDINATOR`. --- ```solidity=11 IMarketPlace private constant oldMarketPlace = IMarketPlace(0x2D9446738C60338e5a6D0416108217B460d6D266); ``` - The contract `WarriorNFT` interacts with third party contract with `IMarketPlace` interface via `oldMarketPlace`. --- ```solidity=13 IReferralSystem referralSystem; ``` - The contract `WarriorNFT` interacts with third party contract with `IReferralSystem` interface via `referralSystem`.
Literals with many digits are difficult to read and review. ```solidity=55 bloodstone.approve(address(rewardPool), 5000000 * 10**18); ``` --- ```solidity=111 bloodstone.approve(_rewardpool, 5000000 * 10**18); ``` --- ```solidity=100 require(_price < 5000000 * 10**18, 'Price can not exceed the BLST total supply'); ``` --- ```solidity=125 require(_price < 5000000 * 10**18, 'Price can not exceed the BLST total supply'); ``` --- ```solidity=66 monsterData[13].reward = 1900000 * 10**14; ``` --- ```solidity=81 monsterData[18].reward = 3800000 * 10**14; ``` --- ```solidity=84 monsterData[19].reward = 4300000 * 10**14; ``` --- ```solidity=87 monsterData[20].reward = 4900000 * 10**14; ``` --- ```solidity=93 monsterData[22].reward = 23000000 * 10**14; ``` --- ```solidity=95 monsterData[23].attack_power = 300000; ``` --- ```solidity=96 monsterData[23].reward = 33000000 * 10**14; ``` --- ```solidity=98 monsterData[24].attack_power = 500000; ``` --- ```solidity=99 monsterData[24].reward = 150000000 * 10**14; ``` --- ```solidity=101 monsterData[25].attack_power = 500000; ``` --- ```solidity=102 monsterData[25].reward = 15000000; ``` --- ```solidity=90 bloodstone.approve(_beast, 5000000 * 1e18); ``` --- ```solidity=91 bloodstone.approve(_warrior, 5000000 * 1e18); ``` --- ```solidity=24 uint32 callbackGasLimit = 500000; ```
The function `address.call()` may return false if the transaction is failed, the local variable `success` should be checked and revert the transaction if failed.
The return value of the transfer()/transferFrom() call is not checked. ```solidity=39 bloodstone.transferFrom(msg.sender, address(rewardPool), blstAmount); ``` --- ```solidity=172 bloodstone.transferFrom(address(rewardPool), msg.sender, executeAmount * tokenIds.length); ``` --- ```solidity=158 bloodstone.transferFrom(msg.sender, address(rewardPool), blstAmount); ``` --- ```solidity=294 BUSD.transferFrom(msg.sender, liquidityPool, (reward * feehandler.getFee(1)) / 10000); ``` --- ```solidity=434 bloodstone.transferFrom(msg.sender, address(rewardPool), blstAmount); ``` --- ```solidity=463 bloodstone.transferFrom(msg.sender, address(rewardPool), blstAmount); ``` --- ```solidity=485 bloodstone.transferFrom(msg.sender, address(rewardPool), blstAmount); ``` --- ```solidity=586 bloodstone.transferFrom(address(rewardPool), msg.sender, feehandler.getBLSTAmount(usdAmount * 10**18)); ``` --- ```solidity=67 bloodstone.transferFrom(msg.sender, address(rewardpool), amountToRewardpool); ``` --- ```solidity=68 bloodstone.transferFrom(msg.sender, items[_itemType][_tokenId].seller, amountToSeller); ``` --- ```solidity=213 bloodstone.transfer(msg.sender, claimingAmountInBLST); ``` --- ```solidity=51 bloodstone.transferFrom(msg.sender, address(rewardPool), blstAmount); ```
The contracts have unlocked compiler version in this codebase. An unlocked compiler version in the source code of the contract permits the user to compile it at or above a particular version. This, in turn, leads to differences in the generated bytecode between compilations due to differing compiler version numbers. This can lead to ambiguity when debugging as compiler-specific bugs may occur in the codebase that would be hard to identify over a span of multiple compiler versions rather than a specific one.
The return value of an external call is not stored in a local or state variable. ```solidity=55 bloodstone.approve(address(rewardPool), 5000000 * 10**18); ``` --- ```solidity=111 bloodstone.approve(_rewardpool, 5000000 * 10**18); ``` --- ```solidity=90 bloodstone.approve(_beast, 5000000 * 1e18); ``` --- ```solidity=91 bloodstone.approve(_warrior, 5000000 * 1e18); ```
The linked functions are equivalent to the compiler-generated getter functions for the respective variables.
The linked variables could be declared as `constant` since these state variables are never modified.
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 (21)
1,045 projects reviewed · 1,376 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