code-423n4 / 2021-09-yaxis-findings

0 stars 0 forks source link

Join _checkToken function and modifier together #91

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

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.

Haz077 commented 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.

uN2RVw5q commented 2 years ago

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

GalloDaSballo commented 2 years ago

Sponsor acknowledged and mitigated