Closed code423n4 closed 2 years ago
Jujic
State variable vadger is read two times respectively in mint() function. Caching it in local variable at the beginning of the function and using local variables can save gas.
vadger
mint()
vader.transferFrom(msg.sender, address(this), vAmount); vader.burn(vAmount);
https://github.com/code-423n4/2021-12-vader/blob/00ed84015d4116da2f9db0c68db6742c89e73f65/contracts/tokens/USDV.sol#L73-L74
Remix
Cache vader state variable in local variable at the beginning of the function and use those local variable instead.
vader
Dup #15
Handle
Jujic
Vulnerability details
Impact
State variable
vadger
is read two times respectively inmint()
function. Caching it in local variable at the beginning of the function and using local variables can save gas.Proof of Concept
https://github.com/code-423n4/2021-12-vader/blob/00ed84015d4116da2f9db0c68db6742c89e73f65/contracts/tokens/USDV.sol#L73-L74
Tools Used
Remix
Recommended Mitigation Steps
Cache
vader
state variable in local variable at the beginning of the function and use those local variable instead.