Flokifi II

CertiKFiles named in the report

CertiK reviewed FlokiFi (Flokifi II) on 8 Oct 2023: 11 findings, 0 critical; 9 marked fixed, 2 open.

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

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings11

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

SeverityOpenAcknowledgedFixed
Critical000
High100
Medium001
Low108
Medium`keyId` may be equal to 0Fixed

The `createVaultWithoutKey()` function can be called by someone in the whitelist to create a vault, but does not mint nft, so `IVault(vault).vaultKeyId()` always returns 0 when called within the function `createVaultWithoutKey`, and the variable `vaultByKey[keyId]` will be overwritten.

LowIncompatibility with Deflationary TokensFixed

When transferring deflationary ERC20 tokens, the input amount may not be equal to the received amount due to the charged transaction fee. For example, if a user sends 100 deflationary tokens (with a 10% transaction fee), only 90 tokens actually arrived to the contract. However, a failure to discount such fees may allow the same user to withdraw 100 tokens from the contract, which causes the contract to lose 10 tokens in such a transaction. Reference: https://thoreum-finance.medium.com/what-exploit-happened-today-for-gocerberus-and-garuda-also-for-lokum-ybear-piggy-caramelswap-3943ee23a39f ```solidity=241 USDT.safeTransferFrom(user, address(this), usdtAmount); ``` - Transferring tokens by `usdtAmount`. ```solidity=263 uint256 treasuryUSDTShare = usdtAmount - referrerUSDTShare - burnShare; ``` - The `usdtAmount` appears to be used for bookkeeping purposes without compensating the potential transfer fees.

LowPotential exemption from chargesFixed

The `_hasDiscount` function is called to check if it owns a certain nft that can be discounted, so there may be some sort of nft supported by this contract that can be used for borrowing, and therefore the user can be exempted from the charge by borrowing the nft.

LowPotential Incorrect ChecksFixed

The function `isV2LiquidityPoolToken()` is designed to check if the passed-in address token is an uniswap v2 pair, the function's checking is lax, and a malicious user can build a contract to pass the check, as is the case with the `isV3LiquidityPoolToken` function.

LowPotential Removal FailsFixed

The `removeTokensFromSwappingByIndexes()` function is called to remove the addresses of the tokens at the specified locations. Since the removal is cyclic, it is possible that the incoming locations have already been removed and the function call will fail. ```solidity=141 address tokenAddress = _tokens[index].tokenAddress; _tokens[index] = _tokens[_tokens.length - 1]; _tokens.pop(); ```

LowPotential Sandwich AttacksFixed

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: - `router.removeLiquidity()` - `router.swapExactTokensForTokens()`

LowPotential tokens are locked to the contractFixed

The `reinvestV3PositionFees()` can be called by the owner of the vault to collect the LP fee and transfer the fee tokens to the current vault, then this part of the token to increase liquidity. ```solidity IERC20(token0).safeApprove(address(tokenAddress), earnedToken0); IERC20(token1).safeApprove(address(tokenAddress), earnedToken1); INonfungiblePositionManager.IncreaseLiquidityParams memory params = INonfungiblePositionManager.IncreaseLiquidityParams({ tokenId: tokenId, amount0Desired: earnedToken0, amount1Desired: earnedToken1, amount0Min: amount0Min, amount1Min: amount1Min, deadline: block.timestamp }); INonfungiblePositionManager(tokenAddress).increaseLiquidity(params); ``` The function `increaseLiquidity()` returns the amount of tokens used to add liquidity, and the parameter `earnedToken` may not necessarily be equal. As a result, there is a possibility that some tokens will remain in the contract. If these tokens are not present in `fungibleTokenDeposits`, then this portion of tokens will be locked in the contract.

LowThe token received by the `lpTokenProcessor` mayFixed

The function `_processNfts` is called to remove liquidity and collect fees and then transfer the asset to the `lpTokenProcessor` for processing. The token accepted by the `lpTokenProcessor` should be equal to the difference between before and after the transfer. ```solidity=161 IERC20(price.v3LpTokens[i].token0).safeTransfer(address(lpTokenProcessor), balance0); IERC20(price.v3LpTokens[i].token1).safeTransfer(address(lpTokenProcessor), balance1); uint256 amount0Received = initialToken0Balance - IERC20(price.v3LpTokens[i].token0).balanceOf(address(this)); uint256 amount1Received = initialToken1Balance - IERC20(price.v3LpTokens[i].token1).balanceOf(address(this)); ```

LowUnused ValueFixed

The smart contract contains one or more values that are not used, which can lead to unnecessary complexity and reduced maintainability. ```solidity=105 uint256 referrerLPShare = 0; ``` - The variable `referrerLPShare` is never used after this assignment. --- ```solidity=107 referrerLPShare = (price.v2LpAmounts[i] * referrerBasisPoints) / 10000; ``` - The variable `referrerLPShare` is never used after this assignment. --- ```solidity=226 uint256 usdBalance = usdtAmount; ``` - The variable `usdBalance` is never used after this assignment. --- ```solidity=211 try discountNFTs[i].tokenOfOwnerByIndex(user, 0) returns (uint256) { return true; } catch ( bytes memory /* lowLevelData */ ) {} ``` - The variable `` is never used after this assignment.

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

  • contracts/locker/interfaces/ILPTokenProcessorV1.sol
  • contracts/common/interfaces/IVaultKey.sol
  • contracts/locker/VaultDeployer.sol
  • contracts/locker/vault/FungibleVestingVault.sol
  • contracts/locker/interfaces/IVaultFactory.sol
  • contracts/locker/interfaces/ILPTokenProcessorV2.sol
  • contracts/locker/interfaces/IPricingModule.sol
  • contracts/common/oracles/DiaPriceConsumer.sol
  • contracts/common/oracles/PriceOracleManagerV1.sol
  • contracts/common/interfaces/IERC20.sol
  • contracts/common/utils/Whitelist.sol
  • contracts/common/oracles/ManualPriceConsumer.sol
  • contracts/locker/interfaces/IPaymentModule.sol
  • contracts/locker/interfaces/IVaultDeployer.sol
  • contracts/common/oracles/ChainlinkPriceConsumer.sol
  • contracts/locker/vault/Vault.sol
  • contracts/common/interfaces/INonfungiblePositionManager.sol
  • contracts/locker/payment/PricingModuleV1.sol
  • contracts/common/interfaces/IUniswapPair.sol
  • contracts/locker/vault/MultiVault.sol
  • contracts/locker/VaultKey.sol
  • contracts/common/oracles/PythPriceConsumer.sol
  • contracts/locker/payment/LPTokenProcessorV1.sol
  • contracts/locker/payment/PaymentModuleV1.sol
  • contracts/locker/VaultFactory.sol
  • contracts/common/interfaces/IPriceConsumer.sol
  • contracts/locker/payment/LPTokenProcessorV2.sol
  • contracts/locker/interfaces/IDepositHandler.sol
  • contracts/common/interfaces/ISwapRouterV3.sol
  • contracts/common/interfaces/IPriceOracleManager.sol
  • contracts/locker/interfaces/IVault.sol

Part of FlokiFi’s security record

FlokiFi
Audits3 audits by 1 firmLast audit Nov 2023, by CertiK.
Critical findingsNo open critical findingsAcross 3 reports.
Open FlokiFi’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