1.0.3 • Published 4 years ago

@yoyyyyo/sealed v1.0.3

Weekly downloads
-
License
CC0
Repository
-
Last release
4 years ago

sealed

npm - github

a contract which you can "seal"

this is convenient for when you wish to disable particular functions after a certain point, but would still like to keep the ownership of the contract via Ownable.

example

pragma solidity ^0.8.11;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@yoyyyyo/sealed/Sealable.sol";
// SPDX-License-Identifier: CC0

contract ExampleSealed is Ownable, Sealable {
    uint8 importantParameter;
    address publiclyChangeableParameter;

    constructor(uint8 _p) {
        importantParameter = _p;
        publiclyChangeableParameter = msg.sender;
    }

    function changeParameter(uint8 _p) external onlyOwner unsealed {
        importantParameter = _p;
    }
    
    function changePubliclyChangeableParameter() external unsealed {
        publiclyChangeableParameter = msg.sender;
    }
    
}