Metfi 3

CertiKFiles named in the report

CertiK reviewed MetFi DAO (Metfi 3) on 10 Apr 2023: 22 findings, 1 critical; 16 marked fixed, 6 open.

1 critical finding, fixed
Open the reportOpen MetFi DAO’s security record

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings22

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

SeverityOpenAcknowledgedFixed
Critical001
High000
Medium101
Low5014
MediumIncompatibility with Deflationary TokensOpen

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 ### RewardConverter ```solidity=36 primaryStableCoin.safeTransferFrom(msg.sender, address(this), amount); ``` - Transferring tokens by `amount`. ```solidity=29 try pancakeRouter.getAmountsOut(amount, path) returns (uint256[] memory amountsOut) { amountOut = amountsOut[1]; } catch { primaryStableCoin.safeTransferFrom(msg.sender, getAccountToken().ownerOf(nftId), amount); return; } ``` - The `amount` appears to be used for bookkeeping purposes without compensating the potential transfer fees. - Note: `getAmountsOut` is an external function and its behavior wasn't evaluated. ### TreasuryV2 ```solidity=213 IERC20(tokenToUse).safeTransfer(address(controller), amount); ``` - Transferring tokens by `amount`. ```solidity=215 controller.provideLiquidity(tokenToUse, amount, minMETFI); ``` - The `amount` appears to be used for bookkeeping purposes without compensating the potential transfer fees. - Note: `provideLiquidity` is an external function and its behavior wasn't evaluated. --- ```solidity=241 lpToken.safeTransfer(address(controller), lpTokenAmount); ``` - Transferring tokens by `lpTokenAmount`. ```solidity=243 controller.removeLiquidity(tokenToUse, lpTokenAmount, tokenMin); ``` - The `lpTokenAmount` appears to be used for bookkeeping purposes without compensating the potential transfer fees. - Note: `removeLiquidity` is an external function and its behavior wasn't evaluated. --- ```solidity=274 IERC20(token).safeTransferFrom(msg.sender, address(this), amount); ``` - Transferring tokens by `amount`. ```solidity=272 uint256 tokenValue = priceCalculator.tokensForPrice(amount); ``` - The `amount` appears to be used for bookkeeping purposes without compensating the potential transfer fees. - Note: `tokensForPrice` is an external function and its behavior wasn't evaluated. --- ```solidity=290 token.safeTransfer(address(buybackController), tokenAmount); ``` - Transferring tokens by `tokenAmount`. ```solidity=291 buybackController.buyBackMFI(tokenAddress, tokenAmount, minMETFIOut); ``` - The `tokenAmount` appears to be used for bookkeeping purposes without compensating the potential transfer fees. - Note: `buyBackMFI` is an external function and its behavior wasn't evaluated.

LowDependency of the `securityProxy` ContractOpen

When users make transfers of METFI coins, it will trigger the `validateTransfer()` invocation in the `securityProxy` contract, and if the return value is `false`, the transfer transaction will revert. ```solidity=22 function _beforeTokenTransfer(address from, address to, uint256 amount) internal override { if (securityProxy != address(0)) { require(ISecurityProxy(securityProxy).validateTransfer(from, to, amount), "Transfer not allowed"); } super._beforeTokenTransfer(from, to, amount); } ``` Therefore, the `validateTransfer()` function of the `securityProxy` contract can possibly block users from transferring tokens. The scope of the audit treats the `securityProxy` contract as a black box and assumes its functional correctness. However, if the `securityProxy` contract is manipulated or compromised, it could block normal users from transferring tokens.

LowPotential Revert When Performing SwapsOpen

The following situations are not handled in the contracts and will cause the code to revert when encountered. The following situations have been observed. * When there are not enough native tokens sent: `msg.value < requiredBNBAmount` * When no pair for `stableCoin` and `paymentCurrency` is found

LowPotential Revert: Non-guaranteed `AddtionalTokensOpen

The `rebase()` function is designed to adjust the supply of tokens. If enough time has passed since the last rebase and the `dynamicDistribution` is not activated, the `reverseMETFIsPerFragment` will be updated based on a specific `rebaseMultiplier`. It then calculates the `additionalTokens`, the number of new tokens generated during this rebase. ```solidity=344 for (uint256 x = 0; x < levelSettings.length; x++) { currentLevelSettings = levelSettings[x]; oldTokenNum = currentLevelSettings.lockedReverseMETFIs / currentLevelSettings.reverseMETFIsPerFragment; levelSettings[x].reverseMETFIsPerFragment = currentLevelSettings.reverseMETFIsPerFragment * levelSettings[x].rebaseMultiplier[activeHalvingPeriod] / 1000000000; newTokenNum = (currentLevelSettings.lockedReverseMETFIs / levelSettings[x].reverseMETFIsPerFragment); additionalTokens += newTokenNum - oldTokenNum; emit StakingLevelRebased(x, newTokenNum); } rebasesInHalvingCounter.increment(); IMETFIStakingPool(contractRegistry.getContractAddress(METFI_STAKING_POOL_HASH)).withdrawMETFI(address(this), additionalTokens); ``` In the end, it will call the `withdrawMETFI` function in the `METFIStakingPool` contract to withdraw the newly generated tokens. However, there is no guarantee in the given code that the staking pool will always have enough tokens to cover the `additionalTokens` requested during the rebase. This could lead to unintended revert and denial of service in the system if the staking pool does not have enough tokens. The audit team would like to know the source of `METFI` tokens held in both the vault and staking pool contracts, as well as any mechanisms in place to guarantee that these contracts maintain a sufficient balance of `METFI` tokens.

LowPotential Sandwich Attacks And Price SlippageOpen

Users may potentially experience price slippages and sandwich attacks. A sandwich attack might happen when an attacker observes a transaction swapping tokens or adding liquidity without setting restrictions on slippage or the 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 limiting maximum input, potentially resulting in users paying more `paymentCurrency` than they intended: In the `NFTTransferProxyV2` contract, the following code is vulnerable to this attack. ```solidity=50 paymentCurrency.safeApprove(address(pancakeRouter), amounts[0]); paymentCurrency.safeTransferFrom(msg.sender, address(this), amounts[0]); pancakeRouter.swapExactTokensForTokens(amounts[0], amounts[1], path, contractRegistry.getContractAddress(TREASURY_HASH), block.timestamp); ``` The following functions are called without setting restrictions on minimum output amount, so transactions triggering these functions are vulnerable to sandwich attacks, especially when the input amount is large: In the `RewardConverter` contract, the following code is vulnerable to this attack. ```solidity=39 try pancakeRouter.getAmountsOut(amount, path) returns (uint256[] memory amountsOut) { amountOut = amountsOut[1]; } catch { primaryStableCoin.safeTransferFrom(msg.sender, getAccountToken().ownerOf(nftId), amount); return; } ... pancakeRouter.swapExactTokensForTokens( amount, amountOut, path, getAccountToken().ownerOf(nftId), block.timestamp); ``` In the `TokenCollectorV2` contract, the following code is vulnerable to this attack. ```solidity=61 uint256[] memory amounts = pancakeRouter.swapExactTokensForTokens( valueFromSwap, tokensFromSwap, path, to, block.timestamp ); ```

LowPotentially Incorrect `getContractAddress(MFI_HASOpen

The audit team would like to confirm whether the `stakeTokens()` function in the `RouterV3` contract, which currently transfers users' `MFI` tokens to the staking manager, is consistent with the intended design of the new `StakingManagerV3`, `TokenCollectorV2`, and `TreasuryV2` contracts. These contracts specify that the `METFI` token, rather than the `MFI` token, will be stored in the `AccountToken` NFT. ```solidity=285 function stakeTokens(uint256 nftId, uint256 numberOfTokens) external override { verifySenderAndNFT(nftId); rebaseStaking(); //Add tokens to existing staking account IStakingManagerV3 stakingManager = getStakingManager(); stakingManager.addTokensToStaking(nftId, numberOfTokens); //Transfer MFI from user to staking manager IERC20(contractRegistry.getContractAddress(MFI_HASH)).safeTransferFrom(msg.sender, address(stakingManager), numberOfTokens); emit TokensStaked(nftId, numberOfTokens); } ```

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

  • RouterV3.sol
  • TokenCollectorV2.sol
  • RewardConverter.sol
  • NFTTransferProxyV2.sol
  • METFIVault.sol
  • PlatformViewV2.sol
  • BurnControllerV2.sol
  • TreasuryV2.sol
  • METFI.sol
  • METFIStakingPool.sol
  • ContractRegistryUser.sol
  • ContractRegistryHashes.sol
  • ContractRegistryAdmin.sol
  • StakingManagerV3.sol

Part of MetFi DAO’s security record

MetFi DAO
Audits4 audits by 1 firmLast audit Feb 2024, by CertiK.
Critical findingsNo open critical findingsAcross the 4 reports, 1 critical finding was reported. It is marked fixed by the firm that reported it.
Open MetFi DAO’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