Volt Protocol contest - Funen's results

Inflation Protected Stablecoin.

General Information

Platform: Code4rena

Start Date: 31/03/2022

Pot Size: $75,000 USDC

Total HM: 7

Participants: 42

Period: 7 days

Judge: Jack the Pug

Total Solo HM: 5

Id: 102

League: ETH

Volt Protocol

Findings Distribution

Researcher Performance

Rank: 18/42

Findings: 2

Award: $228.99

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

124.9825 USDC - $124.98

Labels

bug
QA (Quality Assurance)

External Links

  1. Change Fei into Volt on Comment

Comment has to be changed, for Fei to Volt Instead, so comment would be more clearly and doesnt do missinformation.

##Tool Used Manual Review

##Recommended Mitigation change to Volt

##Occurances

main/contracts/core/Core.sol #L11 main/contracts/core/Core.sol #L14 main/contracts/core/Permission.sol #L8 main/contracts/pvc/PVCDeposit.sol #L9 main/contracts/pvc/compound/CompoundPCVDepositBase.sol #L21 main/contracts/pvc/compound/CompoundPCVDepositBase.sol #L28 main/contracts/pvc/compound/CompoundPCVDepositBase.sol #L52 main/contracts/volt/Volt.sol #7-8 main/contracts/volt/Volt.sol #17-18 main/contracts/volt/Volt.sol #38 main/contracts/volt/Volt.sol #51 main/contracts/volt/Volt.sol #58-59

Awards

104.0146 USDC - $104.01

Labels

bug
G (Gas Optimization)

External Links

  1. Unnecessary Zero Check

https://github.com/code-423n4/2022-03-volt/blob/f1210bf3151095e4d371c9e9d7682d9031860bbd/contracts/peg/NonCustodialPSM.sol#L292

amountFeiToTransfer doesnt need to be checked if was zero

##Tool Used Visual Studio Code, Manual Review

##Reccomendation Mitigation Remove it

  1. Betterway to use SafeERC20 function for gas saving

https://github.com/code-423n4/2022-03-volt/blob/main/contracts/pcv/PCVDeposit.sol this implementation can be used for another gas opt

##Impact Expensive gas

##POC https://docs.openzeppelin.com/contracts/3.x/api/token/erc20#SafeERC20

##Tool Used Manual Review

##Reccomendation Mitigation Steps by do not declaring using SafeERC20 for IERC20; and used safeTransfer and safeTransferFrom.

  1. change multiple if into if-elseif logic for saving more gas

https://github.com/code-423n4/2022-03-volt/blob/f1210bf3151095e4d371c9e9d7682d9031860bbd/contracts/peg/NonCustodialPSM.sol#L292-L298 This implementation can be using for saving more gas.

##Tool used Visual Studio Code, Manual Review

##Recommended Mitigation Step

if (amountFeiToTransfer != 0) { IERC20(volt()).safeTransfer(to, amountFeiToTransfer); } if (amountFeiToMint != 0) { rateLimitedMinter.mintVolt(to, amountFeiToMint); }

change to else if to save gas :

if (amountFeiToTransfer != 0) { IERC20(volt()).safeTransfer(to, amountFeiToTransfer); } else if (amountFeiToMint != 0) { rateLimitedMinter.mintVolt(to, amountFeiToMint); }
  1. Unnecessary Constructor can be removed

https://github.com/code-423n4/2022-03-volt/blob/f1210bf3151095e4d371c9e9d7682d9031860bbd/contracts/refs/CoreRef.sol#L27

since this was no-op, removed this can be saving more gas.

##Impact Expensive gas

##Tool used Remix

##Recommended Mitigation Remove Constructor

  1. Public Function to External for saving gas

This functions could be set external to saving more gas gas

##Impact Expensive Gas

##POC https://github.com/code-423n4/2022-03-volt/blob/f1210bf3151095e4d371c9e9d7682d9031860bbd/contracts/core/Permissions.sol#L187 https://github.com/code-423n4/2022-03-volt/blob/f1210bf3151095e4d371c9e9d7682d9031860bbd/contracts/core/Permissions.sol#L202

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