Timeswap contest - Breeje's results

Like Uniswap, but for lending & borrowing.

General Information

Platform: Code4rena

Start Date: 20/01/2023

Pot Size: $90,500 USDC

Total HM: 10

Participants: 59

Period: 7 days

Judge: Picodes

Total Solo HM: 4

Id: 206

League: ETH

Timeswap

Findings Distribution

Researcher Performance

Rank: 42/59

Findings: 1

Award: $65.35

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

65.3481 USDC - $65.35

Labels

bug
grade-b
QA (Quality Assurance)
Q-04

External Links

QA Report

IssueInstances
L-1USE OF FLOATING PRAGMA8
L-2DUMMY URI USED IN TimeswapV2Token AND TimeswapV2LiquidityToken2
L-3NO ZERO ADDRESS CHECK1
NC-1INCORRECT NATSPEC1
NC-2SPELLING ERROR IN NATSPEC76
NC-3INCORRECT ERROR TYPE1
NC-44 METHODS WITH durationForward AS SECOND PARAMETER CAN BE REMOVED4

[L-1] USE OF FLOATING PRAGMA

Impact: swcregistry

Instances (8):

File: v2-token/src/TimeswapV2LiquidityToken.sol

2:    pragma solidity ^0.8.8;

Link to Code

File: v2-token/src/TimeswapV2Token.sol

2:    pragma solidity ^0.8.8;

Link to Code

File: v2-token/src/base/ERC1155Enumerable.sol

4:    pragma solidity ^0.8.8;

Link to Code

File: v2-token/src/interfaces/IERC1155Enumerable.sol

4:    pragma solidity ^0.8.8;

Link to Code

File: v2-token/src/structs/CallbackParam.sol

2:    pragma solidity ^0.8.8;

Link to Code

File: v2-token/src/structs/FeesPosition.sol

2:    pragma solidity ^0.8.8;

Link to Code

File: v2-token/src/structs/Param.sol

2:    pragma solidity ^0.8.8;

Link to Code

File: v2-token/src/structs/Position.sol

2:    pragma solidity ^0.8.8;

Link to Code

[L-2] DUMMY URI USED IN TimeswapV2Token AND TimeswapV2LiquidityToken

Instead of setting the Real URI, Dummy URI is used.

Instance (2):

File: packages/v2-token/src/TimeswapV2Token.sol

41:      constructor(address chosenOptionFactory) ERC1155("Timeswap V2 address") {

Link to Code

File: packages/v2-token/src/TimeswapV2LiquidityToken.sol

36:      constructor(address chosenOptionFactory, address chosenPoolFactory) ERC1155("Timeswap V2 uint160 address") {

Link to Code

[L-3] NO ZERO ADDRESS CHECK

Instance (1):

File: packages/v2-token/src/TimeswapV2Token.sol

42:      optionFactory = chosenOptionFactory;

Link to Code

[NC-1] INCORRECT NATSPEC

Replace IsSubToken0 if false to IsSubToken1 if false.

Instance (1):

File: packages/v2-option/src/structs/Process.sol

32:      /// @param isAddToken1 IsAddToken1 if true. IsSubToken0 if false.

Link to Code

[NC-2] SPELLING ERROR IN NATSPEC

Correct the spelling of "multiple".

Instances:

File: packages/v2-option/src/structs/Process.sol

4:      /// @dev Processing information required for interacting multple options in a single contract.

Link to Code

Correct the spelling of "to".

File: packages/v2-library/src/StrikeConversion.sol

22:     /// @param amount The amount ot be converted. Token0 amount when zeroToOne. Token1 amount when oneToZero.

Link to Code

Correct the spelling of "position".

File: packages/v2-token/src/interfaces/ITimeswapV2Token.sol

27:     /// @dev mints TimeswapV2Token as per postion and amount

32:     /// @dev burns TimeswapV2Token as per postion and amount

Link to Code

Spelling of recipient is wrongly spelled as receipient in entire codebase (72 Instances).

[NC-3] INCORRECT ERROR TYPE

Zero Address Error thrown when Address is not Zero.

Instances (1):

File: packages/v2-pool/src/TimeswapV2PoolFactory.sol

63:      if (pair != address(0)) Error.zeroAddress();

Link to Code

[NC-4] 4 METHODS WITH durationForward AS SECOND PARAMETER CAN BE REMOVED

In TimeswapV2Pool Contract, mint, burn, deleverage and leverage methods are used with 2 Parameters: param and durationForward.

File: packages/v2-pool/src/TimeswapV2Pool.sol

      function mint(
          TimeswapV2PoolMintParam calldata param,
          uint96 durationForward
      ) external override returns (uint160 liquidityAmount, uint256 long0Amount, uint256 long1Amount, uint256 shortAmount, bytes memory data) {
          return mint(param, true, durationForward);
      }


286:  if (isQuote) revert Quote();

      function burn(
          TimeswapV2PoolBurnParam calldata param,
          uint96 durationForward
      ) external override returns (uint160 liquidityAmount, uint256 long0Amount, uint256 long1Amount, uint256 shortAmount, bytes memory data) {
          return burn(param, true, durationForward);
      }

355:  if (isQuote) revert Quote();

      function deleverage(
          TimeswapV2PoolDeleverageParam calldata param,
          uint96 durationForward
      ) external override returns (uint256 long0Amount, uint256 long1Amount, uint256 shortAmount, bytes memory data) {
          return deleverage(param, true, durationForward);
      }
      
407:  if (isQuote) revert Quote();

      function leverage(TimeswapV2PoolLeverageParam calldata param, uint96 durationForward) external override returns (uint256 long0Amount, uint256 long1Amount, uint256 shortAmount, bytes memory data) {
          return leverage(param, true, durationForward);
      }

457:  if (isQuote) revert Quote();

Link to Code

But because of a condition in mint (at Line: 289), burn (at Line: 355), deleverage (at Line: 407) and leverage (at Line: 457) method, the function will always revert. So it is recommended to remove these functions.

#0 - c4-judge

2023-02-01T22:26:16Z

Picodes marked the issue as grade-b

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