In Rewards.sol I have noticed some functions like stake() and withdraw() use the updateReward() modifier
function stake(uint256 amount) public override updateReward(msg.sender) {
require(amount > 0, "Cannot stake 0");
super.stake(amount);
emit Staked(msg.sender, amount);
}
If I am not mistaken it means the modifier code, which does some math and storage, is executed before the require() statement in the called function and hence I guess it could be more gas efficient if the require() is executed first
What do you think?
In
Rewards.solI have noticed some functions likestake()andwithdraw()use theupdateReward()modifierIf I am not mistaken it means the modifier code, which does some math and storage, is executed before the
require()statement in the called function and hence I guess it could be more gas efficient if therequire()is executed firstWhat do you think?