swft

CertiKFiles named in the report

CertiK reviewed SWFT Blockchain (swft) on 21 Jun 2023: 21 findings, 0 critical; 12 marked fixed, 1 acknowledged, 8 open.

No open critical findings
Open the reportOpen SWFT Blockchain’s security record

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings21

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

SeverityOpenAcknowledgedFixed
Critical000
High010
Medium003
Low809
LowCan Use Custom ErrorsOpen

From Solidity `v0.8.4`, there are more gas-efficient ways to explain to users why an operation failed than through strings. Using custom errors can significantly reduce the size of the deployed bytecode and reduce the gas cost when calls revert.

LowEvent Should Include FeeOpen

In the contract `AggregatorV2`, the following functions charge a `fee` specified in the order. As this `fee` can change from order to order we recommend emitting it in the functions corresponding event. - `swapTokenToToken()`; - `swapTokenToETH()`; - `swapETHToToken()`; - `swapTokenToTokenNft()`; - `swapETHToTokenNft()`.

LowInconsistent Fee ChargingOpen

The `SwapNftOrder` struct includes a `fee` which is not always charged. For tokens, a fee is charged whenever the transaction is completed on a single chain, however this is not done for NFTs. The functions `swapTokenToETHNft()`, `swapTokenToNft()`, and `swapETHToNft()` complete the transaction on a single chain, however no fee is charged.

LowInconsistent Use Of `to` And `mid`Open

In the contract `AggregatorV2`, `mid` is used when there is a swap done on the chain prior to a cross chain swap. However, the following places in the code still use `to`, when it is more consistent to use `mid`: - In the function `swapWithDex()`, `_toBalanceOrigin` is used instead of `midBalanceOrigin`; - In the function `swapToETHWithDex()`, `_toBalanceOrigin` is used instead of `midBalanceOrigin` and `_toInputAmt` is used instead of `midInputAmt`.

LowMissing/Inconsistent ChecksOpen

The functions `callDextoETH()` and `callDex()` do not check that `fromAmt > 0`. The functions `swapETHToToken()` and `swapETHToTokenNft()` check that the `msg.value` is greater than or equal to the `order.fromAmount` and then use the `fromAmount.sub(feeAmount)` in the call to the DEX. As the `fromAmount` is used we recommend checking that `fromAmount == msg.value`. In addition, we recommend rewriting the checks in `swapFromEthWithDex()` to be consistent along all three functions. The function `swapETHToNFT` checks that the `msg.value >= order.fromAmount`, however, the `nftBaseAmount` is used in the call to the DEX. We recommend checking that the `msg.value == order.nftBaseAmount`. In the function `swapETHToTokenNft()` it is checked that `order.fromAmount >= 0`, when `order.fromAmount` is a `uint256`. Thus this check will always pass. We recommend instead checking that it is strictly greater than 0. In the function `swapETHToNft()` it is checked that `order.fromAmount >= 0`, when `order.fromAmount` is a `uint256`. Thus this check will always pass. We recommend instead checking that it is strictly greater than 0.

LowTyposOpen

In the contract `SwftSwap` the following typos were found: - In the function `swap()`, the error message "FROMTOKEN_CANT_T_BE_0" should be "FROM_TOKEN_CANT_BE_0". - During remediations the error message above was changed to "NOT_ENOUGH_FROM_TOKEN_TRANSFER_TO_THIS_CONCTION" where there is the typo "CONCTION". In addition we recommend having the error message reflect that the amount of tokens received did not equal the input amount. For example: "CONTRACT_DID_NOT_RECEIVE_SAME_FROM_AMOUNT_AS_INPUT". --- In the contract `AggregatorV3Router` the following typos were found: - In the comments above the function `swap()` there are unnecessary extra words, "@notice Excute transactions. transactions. The handling fee is deducted from the transferred currency." should be "@notice Excute transactions. The handling fee is deducted from the transferred currency." - In the comments above the function `swap()` there is a missing space, "@param toToken Type of target currency, such as'usdt (matic)'" should be "@param toToken Type of target currency, such as 'usdt (matic)'". - In the function `swap()`, the error message "FROMTOKEN_CANT_T_BE_0" should be "FROM_TOKEN_CANT_BE_0". - In the function `swap()`, "NOT_ENOUGH_FROM_TOKEN_TRANSFER_TO_THIS_CONCTION" has the typo "CONCTION". In addition we recommend having the error message reflect that the amount of tokens received did not equal the input amount. - In the function `cossSwap()`, "NO_FROM_TOKEN_TRANSFER_TO_THIS_CONTRACT" does not reflect that the check fails if the contract does not receive the same amount of tokens as was input. --- In the contract `AggregatorV2`: - In the function `swap()`, the error message "FROMTOKEN_CANT_T_BE_0" should be "FROM_TOKEN_CANT_BE_0". - In the function `swapFromEthWithDex()`, the error message "MSG_VALUE_MUST_EQUAL_DEPOSIT_AMMOUNT" should be "MSG_VALUE_MUST_EQUAL_DEPOSIT_AMOUNT". - The comment above the function `swapTokenToTokenNft()` should instead be above the function `swapTokenToETHNft()`. - The functions `swapWithDex()`, `swapToETHWithDex()`, `swap()`, and `swapTokenToETHNft()` where changed to not accept inflationary tokens. However, the error message was not changed to reflect that the amount of tokens received did not equal the input amount.

LowUnlocked Compiler VersionOpen

The contracts cited have an unlocked compiler version. 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.

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.

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 (4)

  • TransferHelper.sol
  • AggregatorV3Router.sol
  • AggregatorV2.sol
  • SwftSwap.sol

Part of SWFT Blockchain’s security record

SWFT Blockchain
Audits1 audit by 1 firmLast audit Jun 2023, by CertiK.
Critical findingsNo open critical findingsIn 1 report.
Open SWFT Blockchain’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