Open code423n4 opened 2 years ago
invert function in OracleRef.sol can be declared private.
invert
OracleRef.sol
https://github.com/code-423n4/2022-03-volt/blob/main/contracts/refs/OracleRef.sol#L84
Declare the function to private.
volt()
_volt
volt() function only returns _volt value. The function can be deleted and declare _volt internal to save gas.
https://github.com/code-423n4/2022-03-volt/blob/main/contracts/refs/CoreRef.sol#L12 https://github.com/code-423n4/2022-03-volt/blob/main/contracts/refs/CoreRef.sol#L193-L195
Change _volt to internal to allow inheriting contracts such as NonCustodialPSM to access directly.
Declare private function to save gas
invert
function inOracleRef.sol
can be declared private.Proof of Concept
https://github.com/code-423n4/2022-03-volt/blob/main/contracts/refs/OracleRef.sol#L84
Recommendation
Declare the function to private.
Delete public
volt()
function and change_volt
to internalvolt()
function only returns_volt
value. The function can be deleted and declare_volt
internal to save gas.Proof of Concept
https://github.com/code-423n4/2022-03-volt/blob/main/contracts/refs/CoreRef.sol#L12 https://github.com/code-423n4/2022-03-volt/blob/main/contracts/refs/CoreRef.sol#L193-L195
Recommendation
Change
_volt
to internal to allow inheriting contracts such as NonCustodialPSM to access directly.