FEI and TRIBE Redemption contest - djxploit's results

A new DeFi primitive that allows any token to become productive and provide FEI liquidity at no cost to the markets that need it most.

General Information

Platform: Code4rena

Start Date: 09/09/2022

Pot Size: $42,000 USDC

Total HM: 2

Participants: 101

Period: 3 days

Judge: hickuphh3

Total Solo HM: 2

Id: 161

League: ETH

Tribe

Findings Distribution

Researcher Performance

Rank: 54/101

Findings: 1

Award: $33.58

🌟 Selected for report: 0

🚀 Solo Findings: 0

Low level issues:

  1. require() check can be bypassed File: SimpleFeiDaiPSM.sol In function mint() and redeem(), the checks: require(amountFeiOut >= minAmountOut, "SimpleFeiDaiPSM: Mint not enough out"); require(amountOut >= minAmountOut, "SimpleFeiDaiPSM: Redeem not enough out"); can be bypassed, as the parameter minAmountOut is given as argument.

  2. Typo in emit statements File: SimpleFeiDaiPSM.sol In function mint(), the last parameter of emit statement should be amountOut instead of amountIn. Though their values may be same, but the correction increases readability of the code. Similarly for redeem() , the last parameter of emit statement should be amountOut instead of amountFeiIn

  3. Two functions can be combined into 1, as their logic is same File: SimpleFeiDaiPSM.sol The function getMintAmountOut and getRedeemAmountOut should be merged because both of them just returns the value of the parameter passed, i.e their logic is same.

  4. Unnecessary constants defined. File: SimpleFeiDaiPSM.sol Constants like paused , redeemPaused, mintPaused are defined, but the mint and redeem function doesn't use them. Ex: mint will not stop, even if paused=true. Furthermore there is no function to modify them.

  5. Loop on unbounded arrays can lead to DOS File: TribeRedeemer.sol In previewRedeem function, tokensReceived array is unbounded. So if this array grows quite large, the transaction’s gas cost could exceed the block gas limit and make it impossible to call this function at all. for (uint256 i = 0; i < tokensReceived.length; i++) { Also in redeem function, tokens array is unbounded, which may lead to DOS, if it has a very large length. for (uint256 i = 0; i < tokens.length; i++) {

  6. Immutable address should be 0-checked File: TribeRedeemer.sol : address _redeemedToken in constructor function

Non-critical issues:

  1. Avoid floating pragma. The version should be locked to a particular compiler version

File: SimpleFeiDaiPSM.sol : pragma solidity ^0.8.4; File: TribeRedeemer.sol : pragma solidity ^0.8.4;

  1. Update to the latest compiler version

The compiler of all the 4 in-scope contracts should be upgraded to the latest version, at least above the compiler version 0.8.10

  1. Custom error messages should be used instead of revert strings, to save deployment cost File: SimpleFeiDaiPSM.sol mint(): require(amountFeiOut >= minAmountOut, "SimpleFeiDaiPSM: Mint not enough out"); redeem(): require(amountOut >= minAmountOut, "SimpleFeiDaiPSM: Redeem not enough out");

#0 - HickupHH3

2022-10-08T03:42:13Z

Most of the low level issues raised are invalid.

L1: require() check can be bypassed. Not bypassed, it's a sanity check for the user. Also a virtual slippage check L2-L4: For conformity with PSM module L5: see #223

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter