VTVL contest - Funen'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: 85/198

Findings: 2

Award: $28.24

🌟 Selected for report: 0

🚀 Solo Findings: 0

  1. Missmatch initialSupply_ check

In this down below was the comment section that declared :

// Note: the check whether initial supply is less than or equal than mintableSupply will happen in mint fn.

https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/token/VariableSupplyERC20Token.sol#L31

if condition of initialSupply_ > 0 doesn't declared before if is less than or equal than mintableSupply. so you can be set an require before if condition initialSupply_ <= mintableSupply.

  1. Need to check amount of _amountRequested

https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/VTVLVesting.sol#L398-L411

Should check the mininum of _amountRequested , the example != 0 or > 0 eversince the amount can't be zero so it would be insufficient balance

  1. _initialSupply didn't declared

https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/token/FullPremintERC20Token.sol#L9

_initialSupply can be declared inside that contract (which was used for comment) or can be declare on :

https://github.com/code-423n4/2022-09-vtvl/blob/main/contracts/token/VariableSupplyERC20Token.sol

  1. _initialSupply can be declared as 1e18

https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/token/FullPremintERC20Token.sol#L9

if _initialSupply was declared, it can be changed to be 1e18 to represents the number of decimals to your token.

Since it was 100 * 1e18 it can be direct declare to 1e20 or us the same as it was 100 * 1e18

  1. Consider making contract Pausable

https://github.com/code-423n4/2022-09-vtvl/blob/main/contracts/VTVLVesting.sol

There are many external risks, on that contract for some fn. so my suggestion is that you should consider making the contracts pausable, so in case of an unexpected event, admin can pause transfers.

  1. Locked Pragma Compiler

https://github.com/code-423n4/2022-09-vtvl/blob/main/contracts/token/VariableSupplyERC20Token.sol

Since it was used ^0.8.14. As the compiler can be use for example 0.8.14 and consider locking at this version the same as another. It can be consider using locking the pragma version whenever possible and avoid using a floating pragma in the final deployment. Since it can be problematic, if there are publicly disclosed bugs and issues that affect the current compiler version used.

  1. Unnecessary Comment

This comment can be deleted before deployement for better use

1.) https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/AccessProtected.sol#L12

// user address => admin? mapping

2.) https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/VTVLVesting.sol#L297

// Done with checks

Awards

9.086 USDC - $9.09

Labels

bug
G (Gas Optimization)

External Links

  1. Custom Error

Custom errors can be used from Solidity 0.8.4 are cheaper than revert strings. Its cheaper deployment cost and runtime cost when the revert condition is met.

/contracts/token/FullPremintERC20Token.sol#L11 /contracts/token/VariableSupplyERC20Token.sol#L27 /contracts/token/VariableSupplyERC20Token.sol#L37 /contracts/token/VariableSupplyERC20Token.sol#L41 /contracts/AccessProtected.sol#L25 /contracts/AccessProtected.sol#L40
  1. Rather than public use external instead for saving more gas

1.) https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/AccessProtected.sol#L39

  1. use ++i for saving more gas

https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/VTVLVesting.sol#L353 (++i)

  1. uint256 i = 0 changed to uint256 i for cost less gas

https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/VTVLVesting.sol#L353

  1. Use || rather than && can saving gas

https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/VTVLVesting.sol#L344-L350

This implementation down below can saving gas per iteration and since it was use a lot, it should be save lot of gas

require(_startTimestamps.length == length || _endTimestamps.length == length || _cliffReleaseTimestamps.length == length || _releaseIntervalsSecs.length == length || _linearVestAmounts.length == length || _cliffAmounts.length == length, "ARRAY_LENGTH_MISMATCH" ); // gas deployment //2223531 after (||) //2224732 before (&&)
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