// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;
import "./../utils/GovernableInitializable.sol";
/**
* @title MockGovernableInitializable
* @author solace.fi
* @notice Enforces access control for important functions to [**governor**](/docs/protocol/governance).
*
* Many contracts contain functionality that should only be accessible to a privileged user. The most common access control pattern is [OpenZeppelin's `Ownable`](https://docs.openzeppelin.com/contracts/4.x/access-control#ownership-and-ownable). We instead use `Governable` with a few key differences:
* - Transferring the governance role is a two step process. The current governance must [`setPendingGovernance(pendingGovernance_)`](#setPendingGovernance) then the new governance must [`acceptGovernance()`](#acceptgovernance). This is to safeguard against accidentally setting ownership to the wrong address and locking yourself out of your contract.
* - `governance` is a constructor argument instead of `msg.sender`. This is especially useful when deploying contracts via a [`SingletonFactory`](./interfaces/ISingletonFactory).
* - We use `lockGovernance()` instead of `renounceOwnership()`. `renounceOwnership()` is a prerequisite for the reinitialization bug because it sets `owner = address(0x0)`. We also use the `governanceIsLocked()` flag.
*/
contract MockGovernableInitializable is GovernableInitializable {
/**
* @notice Constructs the governable contract.
* @param governance_ The address of the [governor](/docs/protocol/governance).
*/
constructor(address governance_) {
__Governable_init(governance_);
}
function doThing() external onlyGovernance {
// solhint-disable-next-line no-unused-vars
uint256 x = 1;
}
}
|