VTVL contest - emrekocak's results

Building no-code token management tools to empower web3 founders and investors, starting with token vesting.

General Information

Platform: Code4rena

Start Date: 20/09/2022

Pot Size: $30,000 USDC

Total HM: 12

Participants: 198

Period: 3 days

Judge: 0xean

Total Solo HM: 2

Id: 164

League: ETH

VTVL

Findings Distribution

Researcher Performance

Rank: 182/198

Findings: 1

Award: $9.09

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

9.086 USDC - $9.09

Labels

bug
G (Gas Optimization)
edited-by-warden

External Links

++i COSTS LESS GAS COMPARED TO i++ OR i += 1

++i costs less gas compared to i++ or i += 1 for unsigned integer, as pre-increment is cheaper (about 5 gas per iteration). This statement is true even with the optimizer enabled.

i++ increments i and returns the initial value of i. Which means:

uint i = 1; i++; // == 1 but i == 2 But ++i returns the actual incremented value:

uint i = 1; ++i; // == 2 and i == 2 too, so no need for a temporary variable In the first case, the compiler has to create a temporary variable (when used) for returning 1 instead of 2

Instance includes:

contracts/VTVLVesting.sol:353 I suggest using ++i instead of i++ to increment the value of a uint variable.


In require(), Use != 0 Instead of > 0 With Uint Values

In a require, when checking a uint, using != 0 instead of > 0 saves 6 gas. This will jump over or avoid an extra ISZERO opcode.

Instances include: contracts/token/FullPremintERC20Token.sol:11 contracts/token/VariableSupplyERC20Token.sol:27 contracts/VTVLVesting.sol:107 contracts/VTVLVesting.sol:257 contracts/VTVLVesting.sol:263 contracts/VTVLVesting.sol:449 contracts/VTVLVesting.sol:272-273


Not initializing unit variable to default value of zero

Instance includes: contracts/VTVLVesting.sol:353


Use calldata instead of memory for function parameters

It is generally cheaper to load variables directly from calldata, rather than copying them to memory. Only use memory if the variable needs to be modified.

Instances include: contracts/VTVLVesting.sol:333-358

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