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
Rank: 35/59
Findings: 1
Award: $65.35
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: rbserver
Also found by: 0x1f8b, 0xAgro, 0xGusMcCrae, 0xSmartContract, Awesome, Breeje, DadeKuma, Diana, IllIllI, Josiah, Moksha, RaymondFam, Rolezn, SaeedAlipoor01988, Udsen, Viktor_Cortess, brgltd, btk, chaduke, cryptonue, ddimitrov22, delfin454000, descharre, fatherOfBlocks, georgits, hansfriese, lukris02, luxartvinsec, martin, matrix_0wl, mookimgo, oberon, popular00, shark, tnevler
65.3481 USDC - $65.35
During the audit, 7 non-critical issues were found.
â„– | Title | Risk Rating | Instance Count |
---|---|---|---|
NC-1 | Order of Functions | Non-Critical | 4 |
NC-2 | Order of Layout | Non-Critical | 1 |
NC-3 | Missing leading underscores | Non-Critical | 5 |
NC-4 | Unused named return variables | Non-Critical | 11 |
NC-5 | Missing NatSpec | Non-Critical | 23 |
NC-6 | Typos | Non-Critical | 81 |
NC-7 | Maximum line length exceeded | Non-Critical | 112 |
According to Style Guide, ordering helps readers identify which functions they can call and to find the constructor and fallback definitions easier.
Functions should be grouped according to their visibility and ordered:
constructor should be placed before private functions:
external function should be placed before public function:
private functions should be placed after external and public functions:
Reorder functions where possible.
According to Order of Layout, inside each contract, library or interface, use the following order:
State variables should be placed before constructor:
Private state variables should have a leading underscore.
mapping(bytes32 => uint96) private reentrancyGuards;
mapping(uint256 => mapping(uint256 => Option)) private options;
Process[] private processing;
mapping(uint256 => mapping(uint256 => bool)) private hasInteracted;
StrikeAndMaturity[] private listOfOptions;
Add leading underscores.
Both named return variable(s) and return statement are used.
To improve clarity use only named return variables.
For example, change:
function functionName() returns (uint id) { return x;
to
function functionName() returns (uint id) { id = x;
NatSpec is missing for 23 functions in 7 contracts.
Add NatSpec for all functions.
/// @param addendA0 The least signficant part of addendA.
=> significant
/// @dev When oneToZero, given a larger base amount, and toekn1 amount, get the difference token0 amount.
=> token1
/// @param to The receipeint of liquidity position.
=> recipient
/// @param to The receipeint of fees position.
=> recipient
/// @param long0To The receipient of long0 position fees.
=> recipient
/// @param long1To The receipient of long1 position fees.
=> recipient
/// @param shortTo The receipient of short position fees.
=> recipient
/// @param long0To The receipient of long0 position fees.
=> recipient
/// @param long1To The receipient of long1 position fees.
=> recipient
/// @param shortTo The receipient of short position fees.
=> recipient
/// @param to The receipient of liquidity positions.
=> recipient
/// @param long0To The receipient of long0 positions.
=> recipient
/// @param long1To The receipient of long1 positions.
=> recipient
/// @param shortTo The receipient of short positions.
=> recipient
/// @param to The receipient of short positions.
=> recipient
/// @param long0To The receipient of long0 positions.
=> recipient
/// @param long1To The receipient of long1 positions.
=> recipient
/// @param to If isLong0ToLong1 then receipient of long0 positions, ekse recipient of long1 positions.
=> else
/// @param to If isLong0ToLong1 then receipient of long0 positions, ekse recipient of long1 positions.
=> recipient
/// @param to The receipient of the liquidity positions.
=> recipient
/// @param to The receipient of the transaction fees.
=> recipient
/// @param long0Fees The amount of long0 position fees transferrred.
=> transferred
/// @param long1Fees The amount of long1 position fees transferrred.
=> transferred
/// @param shortFees The amount of short position fees transferrred.
=> transferred
/// @dev The short positions will already be minted to the receipient.
=> recipient
/// @dev The long0 positions and long1 positions will already be minted to the receipients.
=> recipient
/// @param long0Fees The amount of long0 position fees transferrred.
=> transferred
/// @param long1Fees The amount of long1 position fees transferrred.
=> transferred
/// @param shortFees The amount of short position fees transferrred.
=> transferred
/// @dev Reverts when there is not enough time value liqudity to receive when lending.
=> liquidity
/// @return sqrtDiscriminant The square root disriminant calculated.
=> discriminant
/// @return optionPair The retreived option pair address. Zero address if not deployed.
=> retrieved
/// @return poolPair The retreived pool pair address. Zero address if not deployed.
=> retrieved
/// @return optionPair The retreived option pair address.
=> retrieved
/// @return poolPair The retreived pool pair address.
=> retrieved
/// @dev Checks if the pool doesn not exist.
=> does
/// @dev mints TimeswapV2LiquidityToken as per the liqudityAmount
=> liquidityAmount
/// @dev burns TimeswapV2LiquidityToken as per the liqudityAmount
=> liquidityAmount
/// @dev mints TimeswapV2Token as per postion and amount
=> position
/// @dev burns TimeswapV2Token as per postion and amount
=> position
/// @dev Any additional condition to add token enumeration when overidden.
=> overridden
/// @dev Any additional condition to add token enumeration when overidden.
=> overridden
/// @dev Any additional condition to remove token enumeration when overidden.
=> overridden
/// @dev Any additional condition to remove token enumeration when overidden.
=> overridden
console.log("reaches right before mint in timeswapv2Tokne::mint");
=> timeswapv2Token
/// @dev paramater for minting Timeswap V2 Tokens
=> parameter
/// @dev paramater for burning Timeswap V2 Tokens
=> parameter
/// @param data Arbitrary data passed to the callback, initalize as empty if not required.
=> initialize
/// @dev paramater for minting Timeswap V2 Tokens
=> parameter
/// @dev paramater for burning Timeswap V2 Tokens
=> parameter
/// @param data Arbitrary data passed to the callback, initalize as empty if not required.
=> initialize
/// @dev paramater for minting Timeswap V2 Liquidity Tokens
=> parameter
/// @dev paramater for burning Timeswap V2 Liquidity Tokens
=> parameter
/// @param data Arbitrary data passed to the callback, initalize as empty if not required.
=> initialize
/// @dev paramater for collecting fees from Timeswap V2 Liquidity Tokens
=> parameter
/// @param data Arbitrary data passed to the callback, initalize as empty if not required.
=> initialize
/// @param to The address of the receipient of the position.
=> recipient
/// @param long0To The address of the receipient of long token0 position.
=> recipient
/// @param long1To The address of the receipient of long token1 position.
=> recipient
/// @param shortTo The address of the receipient of short position.
=> recipient
/// @param token0To The address of the receipient of token0.
=> recipient
/// @param token1To The address of the receipient of token1.
=> recipient
/// @param tokenTo The address of the receipient of token0 or token1.
=> recipient
/// @param longTo The address of the receipient of long token0 or long token1.
=> recipient
/// @param token0To The address of the receipient of token0.
=> recipient
/// @param token1To The address of the receipient of token1.
=> recipient
/// @param to The address of the receipient of the position.
=> recipient
/// @dev The token0 and token1 will already transferred to the receipients.
=> recipients
/// @dev The long0 positions, long1 positions, and/or short positions will already minted to the receipients.
=> recipients
/// @param long0To The receipient of long0 positions.
=> recipient
/// @param long1To The receipient of long1 positions.
=> recipient
/// @param shortTo The receipient of short positions.
=> recipient
/// @param token0To The receipient of token0 withdrawn.
=> recipient
/// @param token1To The receipient of token1 withdrawn.
=> recipient
/// @notice If data length is zero, skips the calback.
=> callback
/// @param tokenTo The receipient of token0 when isLong0ToLong1 or token1 when isLong1ToLong0.
=> recipient
/// @param longTo The receipient of long1 positions when isLong0ToLong1 or long0 when isLong1ToLong0.
=> recipient
/// @param token0To The receipient of token0 withdrawn.
=> recipient
/// @param token1To The receipient of token1 withdrawn.
=> recipient
/// @notice If data length is zero, skips the calback.
=> callback
// Can be overidden for testing purposes.
=> overridden
According to Style Guide, maximum suggested line length is 120 characters. Longer lines make the code harder to read.
Make the lines shorter.
#0 - c4-judge
2023-02-01T23:46:57Z
Picodes marked the issue as grade-b