Trustswap #2

CertiKFiles named in the report

CertiK reviewed TrustSwap (Trustswap #2) on 27 Dec 2022: 23 findings, 0 critical; 10 marked fixed, 6 acknowledged, 7 open.

No open critical findings
Open the reportOpen TrustSwap’s security record

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings23

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

SeverityOpenAcknowledgedFixed
Critical000
High050
Medium011
Low709
LowCheck Effect Interaction Pattern ViolatedOpen

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. *This finding is considered minor because the reentrancy only causes out-of-order events or because the state variable is only incremented or decremented. So, the effect of out-of-order increments may be unobservable after the transaction. However, the reentrancy vulnerability may still cause other issues in the middle of a transaction.* ----- Although in `LockToken` many functions are using the `ReentrancyGuard` modifier, some functions changing state variables are not using it. Moreover, the function `setNotEntered()` can be used to deactivate this modifier and reenter the functions supposedly protected.

LowMissing Emit EventsOpen

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

LowRedundant StatementsOpen

The linked statements do not affect the functionality of the codebase and appear to be either remnant of test code or older functionality.

LowSolidity Version Not Recommended | Different SoliOpen

Solidity frequently releases new compiler versions. Using an old version prevents access to new Solidity security features. ```solidity=1 pragma solidity 0.6.2; ``` ```solidity=1 pragma solidity ^0.6.0; ``` are not recommended for deployment ----- Multiple Solidity versions are used in the codebase. Versions used: `^0.6.2`, `^0.6.0`, `>=0.4.24<0.7.0`, `0.8.9`

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 assumes 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=48 address public usdTokenAddress; ``` - The contract `LockToken` interacts with third party contract with `IERC20Extended` interface via `usdTokenAddress`. --- ```solidity=136 address _tokenAddress, ``` - The function `LockToken.lockToken` interacts with third party contract with `IERC20` interface via `_tokenAddress`. --- ```solidity=174 address _tokenAddress, ``` - The function `LockToken.lockNFT` interacts with third party contract with `IERC721` interface via `_tokenAddress`. --- ```solidity=12 (address tokenAddress, ,uint256 tokenAmount, uint256 unlockTime, , uint256 nftTokenId, bool isNFT , ,) = lockToken.getDepositDetails(tokenId); ``` - The function `NFTDescriptor.tokenURI` interacts with third party contract with `IERC20Extended` interface via `tokenAddress`. --- ```solidity=11 IUniswapV2Router02 internal uniswapRouter; ``` - The contract `PriceEstimator` interacts with third party contract with `IUniswapV2Router02` interface via `uniswapRouter`.

LowUnprotected InitializerOpen

One or more logic contracts do not protect their initializers. An attacker can call the initializer and assume ownership of the logic contract, whereby she can perform privileged operations that trick unsuspecting users into believing that she is the owner of the upgradeable contract. ```solidity=10 contract LockNFT is Initializable, OwnableUpgradeable, ERC721Upgradeable{ ``` - `LockNFT` is an upgradeable contract that does not protect its initializer. ```solidity=21 function initialize(string calldata _name, string calldata _symbol, address _lockTokenAddress, address _descriptorAddress) ``` - `initialize` is an unprotected initializer function. --- ```solidity=15 contract LockToken is Initializable, OwnableUpgradeSafe, PausableUpgradeSafe, IERC721Receiver { ``` - `LockToken` is an upgradeable contract that does not protect its initializer. ```solidity=108 function initialize() ``` - `initialize` is an unprotected initializer function. --- ```solidity=8 contract NFT is Initializable, ERC721UpgradeSafe, OwnableUpgradeSafe{ ``` - `NFT` is an upgradeable contract that does not protect its initializer. ```solidity=9 function initialize(string calldata _name, string calldata _symbol) ``` - `initialize` is an unprotected initializer function. --- ```solidity=9 contract NFTDescriptor is Initializable{ ``` - `NFTDescriptor` is an upgradeable contract that does not protect its initializer. ```solidity=10 function initialize() external{} ``` - `initialize` is an unprotected initializer function. --- ```solidity=8 contract PriceEstimator is IPriceEstimator, Initializable, OwnableUpgradeSafe { ``` - `PriceEstimator` is an upgradeable contract that does not protect its initializer. ```solidity=19 function initialize(address uniswapRouterAddress) ``` - `initialize` is an unprotected initializer function.

LowUser-Defined GettersOpen

The linked functions are equivalent to the compiler-generated getter functions for the respective variables.

Contracts in scope

No deployed address is recorded for this audit.

The report names a repository or files. Open the report to see its scope.

Repository and files the report names (12)

  • contracts/IPriceEstimator.sol
  • contracts/ILockToken.sol
  • contracts/NFT.sol
  • contracts/IERC20Extended.sol
  • contracts/IERC20.sol
  • contracts/IV3Migrator.sol
  • contracts/LockToken.sol
  • contracts/LockNFT.sol
  • contracts/INFTDescriptor.sol
  • contracts/PriceEstimator.sol
  • contracts/IERC721Extended.sol
  • contracts/NFTDescriptor.sol

Part of TrustSwap’s security record

TrustSwap
Audits2 audits by 2 firmsLast audit Dec 2022, by CertiK.
Critical findingsNo open critical findingsAcross 2 reports.
Open TrustSwap’s security record

Security firm

CertiK

1,045 projects reviewed · 1,376 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