// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import '@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol'; /** * @title Controllable */ contract Controllable is AccessControlEnumerableUpgradeable { bool private _started; string private _contractURI; string private _baseURI; function __Controllable_init() internal onlyInitializing { __AccessControlEnumerable_init(); __Controllable_init_unchained(); } function __Controllable_init_unchained() internal onlyInitializing { _grantRole(DEFAULT_ADMIN_ROLE, _msgSender()); } /** * @dev Only allow access from the DEFAULT_ADMIN_ROLE */ modifier onlyAdmin() { require(isAdmin(_msgSender()), 'Controllable: Restricted to Admins'); _; } /** * @dev Verify account has DEFAULT_ADMIN_ROLE * @param account - The account address to verify */ function isAdmin(address account) public view returns (bool) { return hasRole(DEFAULT_ADMIN_ROLE, account); } /** * @dev Return contractURI */ function contractURI() external view virtual returns (string memory) { return _contractURI; } /** * @dev Return baseURI */ function baseURI() public view virtual returns (string memory) { return _baseURI; } /** * @dev Verify if minting has started */ function isStarted() public view virtual returns (bool) { return _started; } /** * @dev Start Minting * - Verify that the caller is the owner */ function startMinting() external virtual onlyAdmin { _started = true; } /** * @dev Allow to set contract URI - Internal function * @param newContractURI - IPFS pointing to the new contract URI file * - Verify that the caller is the owner */ function _setContractURI(string memory newContractURI) internal virtual { _contractURI = newContractURI; } /** * @dev Allow to set base URI - Internal function * @param newBaseURI - IPFS pointing to the new base URI file * - Verify that the caller is the owner */ function _setBaseURI(string memory newBaseURI) internal virtual { _baseURI = newBaseURI; } /** * @dev Allow to set contract URI * @param newContractURI - IPFS pointing to the new contract URI file * - Verify that the caller is the owner */ function setContractURI(string memory newContractURI) external virtual onlyAdmin { _setContractURI(newContractURI); } /** * @dev Allow to set base URI * @param newBaseURI - IPFS pointing to the new base URI file * - Verify that the caller is the owner */ function setBaseURI(string memory newBaseURI) external virtual onlyAdmin { _setBaseURI(newBaseURI); } /** * @dev Allow owner to withdraw any ether sent to this contract * - Verify that the caller is the owner */ function withdrawEther() external virtual onlyAdmin returns (bool success) { (success, ) = payable(msg.sender).call{ value: address(this).balance }(''); } uint256[50] private __gap; }