Disabling renounceOwnership

Hello
I want to disable renounceOwnership to prevent an accidental fat fingered disaster. I can override it in my contract, but is the best practice, or is there a better way to do it.

Thanks.

1 Like

Hi @guiguy,

Whilst you could override renounceOwnership. I would suggest looking at using Role-Based Access Control where you could have an admin role which only has permission to revoke a role.

Correct me if I’m wrong but it looks like there can only be one owner and the owner can revoke ownself leaving the contract ownerless. As I understand it, that would make it impossible for the contract to send tokens or eth from itself. Whereas, the roles just affect the minting and pausing for the 721 preset I’m using.

1 Like

Hi @guiguy,

Yes. If you use Ownable there is only one owner at a time (though this could be another contract such as a multisig) and ownership can be revoked leaving no owner.

Ownable is a simple form of access control. AccessControl has more granular permissions.

You could use AccessControl instead on Ownable, with a role per function type. It depends what smart contract functionality your contract has that you restrict using access control.

So you could have a Minter Role and a Pauser Role. When you no longer need pause functionality, you could revoke the role. If you only used Ownable, and still needed to be able to mint, you wouldn’t be able to do this.

If you want to be able to withdraw tokens/Ether from a contract, then you will need to create this functionality and include appropriate access control.