Skip to content

Instantly share code, notes, and snippets.

@kennethhutw
Created January 30, 2022 09:07
Show Gist options
  • Save kennethhutw/b2666bcab1f0140e7addf403781a8ad8 to your computer and use it in GitHub Desktop.
Save kennethhutw/b2666bcab1f0140e7addf403781a8ad8 to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
contract Params is Initializable,OwnableUpgradeable {
function initialize()public initializer{
__Context_init_unchained();
__Ownable_init_unchained();
}
mapping(string => uint256) private uint256Params;
event Uint256ParamSetted(string indexed _key,uint256 _value);
function SetUint256Param(string memory _key,uint256 _value) external onlyOwner{
uint256Params[_key] = _value;
emit Uint256ParamSetted(_key,_value);
}
function GetUint256Param(string memory _key)public view returns(uint256){
uint256 v = uint256Params[_key];
return v+1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment