THE Protocol ($THE) - Audit

CertiK1 address on Ethereum

CertiK reviewed THE Protocol (THE Protocol ($THE) - Audit) on 31 Oct 2022: 18 findings, 0 critical; 4 marked fixed, 14 open.

No open critical findings
Open the reportOpen THE Protocol’s security record

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings18

Statuses are the security firm’s own, from its report.

SeverityOpenAcknowledgedFixed
Critical000
High201
Medium000
Low1203
HighBurn `$THE` Tokens in the `$THE - ETH` pairOpen

The function `autoBurnLiquidityPairTokens()` that would be triggered in during the transferring of the `THE` token and the function `manualBurnLiquidityPairTokens()` that could be invoked by the owner can burn the `THE` tokens of the `uniswapV2Pair` pair. However, it might not be appropriate that the `THE` tokens are burnt without the approval of other liquidity holders. This will cause the loss of other liquidity holders compared to those who do not hold liquidity.

HighInitial Token DistributionOpen

All of the `THE` tokens are sent to the contract deployer when deploying the contract. This could be a centralization risk as the deployer can distribute `THE` tokens without obtaining the consensus of the community.

LowFunction Should Be Declared ExternalOpen

The functions which are never called internally within the contract should have external visibility for gas optimization. ```solidity=83 function renounceOwnership() public virtual onlyOwner { ``` --- ```solidity=91 function transferOwnership(address newOwner) public virtual onlyOwner { ``` --- ```solidity=280 function name() public view virtual override returns (string memory) { ``` --- ```solidity=288 function symbol() public view virtual override returns (string memory) { ``` --- ```solidity=305 function decimals() public view virtual override returns (uint8) { ``` --- ```solidity=331 function transfer(address recipient, uint256 amount) public virtual override returns (bool) { ``` --- ```solidity=339 function allowance(address owner, address spender) public view virtual override returns (uint256) { ``` --- ```solidity=350 function approve(address spender, uint256 amount) public virtual override returns (bool) { ``` --- ```solidity=368 function transferFrom( ``` --- ```solidity=396 function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { ``` --- ```solidity=415 function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { ``` --- ```solidity=1264 function setAutomatedMarketMakerPair(address pair, bool value) ``` --- ```solidity=1295 function isExcludedFromFees(address account) public view returns (bool) { ```

LowInconsistent Comment and CodeOpen

The comment states `3% from total supply maxWallet`, however the `maxWallet` is actually set to 2%.

LowMissing Emit EventsOpen

There should always be events emitted in the sensitive functions that are controlled by centralization roles.

LowPotential Sandwich AttacksOpen

A sandwich attack might happen when an attacker observes a transaction swapping tokens or adding liquidity without setting restrictions on slippage or minimum output amount. The attacker can manipulate the exchange rate by frontrunning (before the transaction being 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. Potential sandwich attacks could happen in the below cases: - calling `uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens` and `uniswapV2Router.addLiquidityETH` without setting restrictions on slippage. - calling the `autoBurnLiquidityPairTokens()` function and the `manualBurnLiquidityPairTokens()` For example, when we want to make a transaction of swapping 100 `THE` for 1 ETH, an attacker could raise the price of ETH by adding `THE` into the pool before the transaction so we might only get 0.1 ETH. After the transaction, the attacker would be able to withdraw more than he deposited because the total value of the pool increases by 0.9 ETH.

LowState Variable Should Be Declared ConstantOpen

State variables that never change should be declared as `constant` to save gas. ```solidity=1048 uint256 public manualBurnFrequency = 30 minutes; ``` - `manualBurnFrequency` should be declared `constant`.

LowTautology or ContradictionOpen

The comparison, `_percent >= 0`, which is always true may be unnecessary. ```solidity=1537 require( _percent <= 1000 && _percent >= 0, "Must set auto LP burn percent between 0% and 10%" ); ```

LowThird Party DependencyOpen

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=1030 IUniswapV2Router02 public immutable uniswapV2Router; ``` - The contract `THEPROTOCOL` interacts with third party contract with `IUniswapV2Router02` interface via `uniswapV2Router`.

LowUnnecessary Use of SafeMathOpen

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=591 library SafeMath { ``` - An implementation of `SafeMath` library is found. --- ```solidity=1028 using SafeMath for uint256; ``` - `SafeMath` library is used for `uint256` type in `THEPROTOCOL` contract. ```solidity=1418 fees = amount.mul(sellTotalFees).div(100); ``` - `SafeMath.mul` is called in `_transfer` function of `THEPROTOCOL` contract.

Show 4 more
LowUnused EventOpen

```solidity=1083 event UpdateUniswapV2Router( address indexed newAddress, address indexed oldAddress ); ``` - `UpdateUniswapV2Router` is declared in `THEPROTOCOL` but never emitted. --- ```solidity=1299 event BoughtEarly(address indexed sniper); ``` - `BoughtEarly` is declared in `THEPROTOCOL` but never emitted.

LowUnused Return ValueOpen

Function **addLiquidity** [[*link*](https://etherscan.io/address/0x0cba60ca5ef4d42f92a5070a8fedd13be93e2861/THEPROTOCOL.sol#L1461)] from current project triggered expert rules derived from function **addLiquidity** [[*link*](https://bscscan.com/address/0xcb1ddc8f705e2737685a9c1e6b84a63d04d200e5#L769)] from project **DecentralizedUnited**. Here is the description text of a finding from that project that might be relevant. The return value of an external call is not stored in a local or state variable. ```solidity=769 uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable deadWallet, block.timestamp ); ```

LowWrong Denominator When Distributing ETHOpen

The function `swapBack()` swaps part of the `THE` tokens of this contract for ETH, and uses the rest `THE` tokens of this contract to add the liquidity. ```solidity=1474 function swapBack() private { uint256 contractBalance = balanceOf(address(this)); uint256 totalTokensToSwap = tokensForLiquidity + tokensForMarketing + tokensForDev; bool success; if (contractBalance == 0 || totalTokensToSwap == 0) { return; } if (contractBalance > swapTokensAtAmount * 20) { contractBalance = swapTokensAtAmount * 20; } // Halve the amount of liquidity tokens uint256 liquidityTokens = (contractBalance * tokensForLiquidity) / totalTokensToSwap / 2; uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens); uint256 initialETHBalance = address(this).balance; swapTokensForEth(amountToSwapForETH); uint256 ethBalance = address(this).balance.sub(initialETHBalance); uint256 ethForMarketing = ethBalance.mul(tokensForMarketing).div( totalTokensToSwap ); uint256 ethForDev = ethBalance.mul(tokensForDev).div(totalTokensToSwap); ``` The L1499 variable `ethBalance` is the amount of `ETH` which is exchanged in this transaction. `ethBalance` needs to be split into 3 parts, which include adding liquidity and distributing ETH to `tokensForMarketing` and `tokensForDev`. However, when calculating the corresponding ETH part, the dominator is wrong. For example: - `tokensForLiquidity` = 4, `tokensForMarketing` = 4, `tokensForDev` = 4, so the `totalTokensToSwap` = 12; - Then this contract sells (contractBalance * 10 / 12) of the `THE` tokens; - And the denominator in the calculation formula on L1501 and L1504 is `totalTokensToSwap`, which is equivalent to 12. It should be 10 that is the actual `THE` tokens are swapped for ETH. Thus, we think the denominator should be changed to `tokensForLiquidity/2 + tokensForMarketing + tokensForDev`.

LowWrong Value is Emitted in `SwapAndLiquify` EventOpen

In function `swapBack()`, event `SwapAndLiquify` is emitted mistakenly. The `tokensForLiquidity` is set to zero before emitting this event. It is falsely used in the event. ```solidity=1516 emit SwapAndLiquify( amountToSwapForETH, ethForLiquidity, tokensForLiquidity ); ```

Contracts in scope1

AddressChainSource code
0x0cba60ca5ef4d42f92a5070a8fedd13be93e2861Chain: EthereumSource code: Verified source

Part of THE Protocol’s security record

THE Protocol
Audits1 audit by 1 firmLast audit Oct 2022, by CertiK.
Critical findingsNo open critical findingsIn 1 report.
Open THE Protocol’s security record

Security firm

CertiK

1,044 projects reviewed · 1,375 reports · latest May 2025

See CertiK’s audits

Something 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