Open code423n4 opened 3 years ago
0xRajeev
Using parameter _vault instead of SLOAD of state variable vault in the call to safeApprove() leads to gas savings of 100.
https://github.com/code-423n4/2021-06-pooltogether/blob/85f8d044e7e46b7a3c64465dcd5dffa9d70e4a3e/contracts/yield-source/YearnV2YieldSource.sol#L87
https://github.com/code-423n4/2021-06-pooltogether/blob/85f8d044e7e46b7a3c64465dcd5dffa9d70e4a3e/contracts/yield-source/YearnV2YieldSource.sol#L67
https://github.com/code-423n4/2021-06-pooltogether/blob/85f8d044e7e46b7a3c64465dcd5dffa9d70e4a3e/contracts/yield-source/YearnV2YieldSource.sol#L25
Manual Analysis
Using parameter _vault instead of state variable vault in the call to safeApprove()
PR: https://github.com/pooltogether/pooltogether-yearnv2-yield-source/pull/8
Handle
0xRajeev
Vulnerability details
Impact
Using parameter _vault instead of SLOAD of state variable vault in the call to safeApprove() leads to gas savings of 100.
Proof of Concept
https://github.com/code-423n4/2021-06-pooltogether/blob/85f8d044e7e46b7a3c64465dcd5dffa9d70e4a3e/contracts/yield-source/YearnV2YieldSource.sol#L87
https://github.com/code-423n4/2021-06-pooltogether/blob/85f8d044e7e46b7a3c64465dcd5dffa9d70e4a3e/contracts/yield-source/YearnV2YieldSource.sol#L67
https://github.com/code-423n4/2021-06-pooltogether/blob/85f8d044e7e46b7a3c64465dcd5dffa9d70e4a3e/contracts/yield-source/YearnV2YieldSource.sol#L25
Tools Used
Manual Analysis
Recommended Mitigation Steps
Using parameter _vault instead of state variable vault in the call to safeApprove()