code-423n4 / 2021-12-vader-findings

0 stars 0 forks source link

Cache `vader` state variable #80

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

Jujic

Vulnerability details

Impact

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.

Proof of Concept

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

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.

jack-the-pug commented 2 years ago

Dup #15