Trust-Ai

CertiK1 address on BNB Chain

CertiK reviewed Trust AI (Trust-Ai) on 6 Dec 2023: 19 findings, 0 critical; 4 marked fixed, 2 acknowledged, 13 open.

No open critical findings
Open the reportOpen Trust AI’s security record

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings19

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

SeverityOpenAcknowledgedFixed
Critical000
High012
Medium011
Low1301
LowIncorrect CalculationOpen

Half the amount of liquidity tokens are not swapped, therefore the denominator `totalTokensToSwap` does not correspond to the actual BNB balance change. The resulting `ethForMarketing`, `ethForDev`, and `ethForBuyBack` will be a little less than deserved, and `ethForLiquidity` will be more than what should be when `amountToSwapForETH` is used as the denominator.

LowMissing Emit EventsOpen

Privileged functions that update state variables should emit relevant events as notifications.

LowMissing Zero Address ValidationOpen

Addresses are not validated before assignment or external calls, potentially allowing the use of zero addresses and leading to unexpected behavior or vulnerabilities. For example, transferring tokens to a zero address can result in a permanent loss of those tokens. ```solidity=1063 marketingWallet = newMarketingWallet; ``` - `newMarketingWallet` is not zero-checked before being used. --- ```solidity=1068 devWallet = newWallet; ``` - `newWallet` is not zero-checked before being used. --- ```solidity=1073 buyBackWallet = newWallet; ``` - `newWallet` is not zero-checked before being used.

LowMissing Zero Amount CheckOpen

The function `swapTokensForEth()` doesn't check if the `tokenAmount` variable is above zero before executing. This could cause gas costs for each function call.

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 backrunning (after the transaction being 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: - `addLiquidityETH()` - `swapExactTokensForETHSupportingFeeOnTransferTokens()`

LowRedundant WritesOpen

Variables are written but never read and subsequently written again, suggesting potential inefficiencies or logic errors in the code. This may lead to confusion when analyzing the code or impact the performance of the smart contract during execution. `success` is written twice, but not used in-between. ```solidity=1234 (success,) = address(devWallet).call{value: ethForDev}(""); ``` ```solidity=1235 (success,) = address(buyBackWallet).call{value: ethForBuyBack}(""); ```

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=177 using SafeMath for uint256; ``` - `SafeMath` library is used for `uint256` type in `ERC20` contract. ```solidity=299 _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); ``` - `SafeMath.sub` is called in `transferFrom` function of `ERC20` contract. *Note: Only a sample of 2 `SafeMath` library usage in this contract (out of 11) are shown above.* --- ```solidity=454 library SafeMath { ``` - An implementation of `SafeMath` library is found. --- ```solidity=177 using SafeMath for uint256; ``` - `SafeMath` library is used for `uint256` type in `ERC20` contract. ```solidity=1128 fees = amount.mul(sellTotalFees).div(100); ``` - `SafeMath.mul` is called in `_transfer` function of `TRUSTAI` contract. *Note: Only a sample of 2 `SafeMath` library usage in this contract (out of 14) are shown above.*

LowUnused ContractOpen

```solidity=711 library SafeMathInt { ``` - The library `SafeMathInt` is declared but never used.

LowUnused EventOpen

Some events are never emitted, which can lead to confusion and code maintainability issues. ```solidity=900 event UpdateUniswapV2Router(address indexed newAddress, address indexed oldAddress); ```

LowUnused Return ValueOpen

The smart contract does not check or store the return value of an external call in a local or state variable, which may introduce vulnerabilities due to the unhandled outcome. ```solidity=1181 try uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable deadAddress, block.timestamp ) {} catch {} ```

Show 3 more
LowUnused State VariableOpen

Some state variables are not used in the codebase. This can lead to incomplete functionality or potential vulnerabilities if these variables are expected to be utilized. Variable `MAX_INT256` in `SafeMathInt` is never used in `SafeMathInt`. ```solidity=653 int256 private constant MAX_INT256 = ~(int256(1) << 255); ``` ```solidity=651 library SafeMathInt { ```

LowVariables That Could Be Declared as ImmutableOpen

The linked variable assigned in the constructor can be declared as `immutable`. Immutable state variable can be assigned during contract creation but will remain constant throughout the lifetime of a deployed contract. A big advantage of immutable variable is that reading them is significantly cheaper than reading from regular state variable since they will not be stored in storage.

LowWrong Value is Emitted in `SwapAndLiquify` EventOpen

In the function `swapBack()`, the event `SwapAndLiquify` is emitted mistakenly. The `tokensForLiquidity` is set as zero at Line 1239. It is falsely used in the event. ```solidity=1239 emit SwapAndLiquify(amountToSwapForETH, ethForLiquidity, tokensForLiquidity); ```

Contracts in scope1

AddressChainSource code
0x50c7584be73d20760f1947ffcbf7942822c968c8Chain: BNB ChainSource code: Verified source

Part of Trust AI’s security record

Trust AI
Audits1 audit by 1 firmLast audit Dec 2023, by CertiK.
Critical findingsNo open critical findingsIn 1 report.
Open Trust AI’s security record

Security firm

CertiK

1,044 projects reviewed · 1,393 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