Open code423n4 opened 2 years ago
I'm not sure if that will optimize gas that much, also I think code is more organized that way. So in my opinion this issue should be disputed.
I would say that this is a valid issue. Moving the function body into the modifier would save an internal function call: around 20-30 gas. Since checkToken
is frequently used throughout the codebase, I would also recommend changing the gas.
This is implemented in https://github.com/code-423n4/2021-09-yaxis/pull/20
Sponsor acknowledged and mitigated
Handle
pauliax
Vulnerability details
Impact
function _checkToken can be moved to modifier checkToken as it is a private function that is only used by this modifier. This will reduce the number of extra calls and thus reduce the gas.
Recommended Mitigation Steps
Consider moving this function inside the modifier to reduce gas usage.