Override Public function or internal function

I'm a newbie solidity

I have a question about the security smart contract.

I want to use the modifier `` whenNotPaused` of Pausable. If the smart contract is pausing, function about transfer, approve, and burn wil not be active. And my code is

function _transfer(address sender,address recipient,uint256 amount) 
  internal 
  virtual 
  override 
  whenNotPaused 
{
    super._transfer(sender, recipient, amount);
}
function _approve(address owner,address spender,uint256 amount) 
 internal
 virtual 
 override
 whenNotPaused 
{
    super._approve(owner, spender, amount);
}
function _burn(address account, uint256 amount)
 internal
 virtual
 override
 whenNotPaused
{
    super._burn(account, amount);
}

I don't know to should be override public function or internal function.

Is that ok? Can anyone help me? I use solidity version 0.8.7

IMO, modifiers are usually used for public functions. Internal and private functions generally focus on the implementations. This separation can make the management of logics more clear and easier.

So, if I don't override internal then I do this with public functions => Must I override all functions like: transfer(), transferFrom(), approve(), increaseAllowane(), decreaseAllowance(), burn(), burnFrom() ??

This is the moment you'll have to think carefully about which functuons should have such access controls.

1 Like

Considering that, what is considered best practice.

Would one override the functions on an imported template, with functions calling them on main contract. Or would it be better possibly gas saving to directly edit the template.
Word count I assume does have an effect on the gas price ?

Ty