How to use onlyGovernance modifier?

From what I understand, we need to use onlyGovernance modifier to restrict a function's use so that a function can only be used if it passes through governance process. But how/where does this come from? How can I use this modifier in any of my smart contracts?

Hey @DoDzilla, your understanding of the modifier is correct. The way it works is by inheritance, in which such modifier is inherited to other Governor contracts (eg. GovernorSettings) so they can use it in their implementations.

However, the modifier is not available for general use since it depends on the state of the Governor. You can use it only if you're working on a contract that also inherits from governor.

You can see its implementation here

1 Like

So, there is no way to ensure that a function call is made after a successful governance voting. How to restrict function calls to only governance process