|
{
|
|
"language": "Solidity",
|
|
"settings": {
|
|
"evmVersion": "istanbul",
|
|
"libraries": {},
|
|
"metadata": {
|
|
"bytecodeHash": "ipfs",
|
|
"useLiteralContent": true
|
|
},
|
|
"optimizer": {
|
|
"enabled": true,
|
|
"runs": 2000
|
|
},
|
|
"remappings": [],
|
|
"outputSelection": {
|
|
"*": {
|
|
"*": [
|
|
"evm.bytecode",
|
|
"evm.deployedBytecode",
|
|
"devdoc",
|
|
"userdoc",
|
|
"metadata",
|
|
"abi"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"sources": {
|
|
"src/Interfaces/IERC20.sol": {
|
|
"content": "// SPDX-License-Identifier: AGPL-3.0\r\npragma solidity >=0.7.5;\r\n\r\ninterface IERC20 {\r\n function totalSupply() external view returns (uint256);\r\n\r\n function balanceOf(address account) external view returns (uint256);\r\n\r\n function transfer(address recipient, uint256 amount) external returns (bool);\r\n\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n function transferFrom(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) external returns (bool);\r\n\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n event Approval(address indexed owner, address indexed spender, uint256 value);\r\n}\r\n"
|
|
},
|
|
"src/Interfaces/IERC2612Permit.sol": {
|
|
"content": "// SPDX-License-Identifier: AGPL-3.0-or-later\r\npragma solidity 0.7.5;\r\n\r\ninterface IERC2612Permit {\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over `owner`'s tokens,\r\n * given `owner`'s signed approval.\r\n *\r\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\r\n * ordering also apply here.\r\n *\r\n * Emits an {Approval} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `owner` cannot be the zero address.\r\n * - `spender` cannot be the zero address.\r\n * - `deadline` must be a timestamp in the future.\r\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\r\n * over the EIP712-formatted function arguments.\r\n * - the signature must use ``owner``'s current nonce (see {nonces}).\r\n *\r\n * For more information on the signature format, see the\r\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\r\n * section].\r\n */\r\n function permit(\r\n address owner,\r\n address spender,\r\n uint256 amount,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) external;\r\n\r\n /**\r\n * @dev Returns the current ERC2612 nonce for `owner`. This value must be\r\n * included whenever a signature is generated for {permit}.\r\n *\r\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\r\n * prevents a signature from being used multiple times.\r\n */\r\n function nonces(address owner) external view returns (uint256);\r\n}\r\n"
|
|
},
|
|
"src/Interfaces/ITheopetraAuthority.sol": {
|
|
"content": "// SPDX-License-Identifier: AGPL-3.0\r\npragma solidity >=0.7.5;\r\n\r\ninterface ITheopetraAuthority {\r\n /* ========== EVENTS ========== */\r\n\r\n event GovernorPushed(address indexed from, address indexed to, bool _effectiveImmediately);\r\n event GuardianPushed(address indexed from, address indexed to, bool _effectiveImmediately);\r\n event PolicyPushed(address indexed from, address indexed to, bool _effectiveImmediately);\r\n event ManagerPushed(address indexed from, address indexed to, bool _effectiveImmediately);\r\n event VaultPushed(address indexed from, address indexed to, bool _effectiveImmediately);\r\n event SignerPushed(address indexed from, address indexed to, bool _effectiveImmediately);\r\n\r\n event GovernorPulled(address indexed from, address indexed to);\r\n event GuardianPulled(address indexed from, address indexed to);\r\n event PolicyPulled(address indexed from, address indexed to);\r\n event ManagerPulled(address indexed from, address indexed to);\r\n event VaultPulled(address indexed from, address indexed to);\r\n event SignerPulled(address indexed from, address indexed to);\r\n\r\n /* ========== VIEW ========== */\r\n\r\n function governor() external view returns (address);\r\n\r\n function guardian() external view returns (address);\r\n\r\n function policy() external view returns (address);\r\n\r\n function manager() external view returns (address);\r\n\r\n function vault() external view returns (address);\r\n\r\n function whitelistSigner() external view returns (address);\r\n}\r\n"
|
|
},
|
|
"src/Libraries/Counters.sol": {
|
|
"content": "// SPDX-License-Identifier: AGPL-3.0-or-later\r\npragma solidity 0.7.5;\r\n\r\nimport \"./SafeMath.sol\";\r\n\r\nlibrary Counters {\r\n using SafeMath for uint256;\r\n\r\n struct Counter {\r\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\r\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\r\n // this feature: see https://github.com/ethereum/solidity/issues/4637\r\n uint256 _value; // default: 0\r\n }\r\n\r\n function current(Counter storage counter) internal view returns (uint256) {\r\n return counter._value;\r\n }\r\n\r\n function increment(Counter storage counter) internal {\r\n // The {SafeMath} overflow check can be skipped here, see the comment at the top\r\n counter._value += 1;\r\n }\r\n\r\n function decrement(Counter storage counter) internal {\r\n counter._value = counter._value.sub(1);\r\n }\r\n}\r\n"
|
|
},
|
|
"src/Libraries/SafeMath.sol": {
|
|
"content": "// SPDX-License-Identifier: AGPL-3.0-or-later\r\npragma solidity 0.7.5;\r\n\r\n/**\r\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\r\n * checks.\r\n *\r\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\r\n * in bugs, because programmers usually assume that an overflow raises an\r\n * error, which is the standard behavior in high level programming languages.\r\n * `SafeMath` restores this intuition by reverting the transaction when an\r\n * operation overflows.\r\n *\r\n * Using this library instead of the unchecked operations eliminates an entire\r\n * class of bugs, so it's recommended to use it always.\r\n */\r\nlibrary SafeMath {\r\n /**\r\n * @dev Returns the addition of two unsigned integers, reverting on\r\n * overflow.\r\n *\r\n * Counterpart to Solidity's `+` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Addition cannot overflow.\r\n */\r\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\r\n uint256 c = a + b;\r\n require(c >= a, \"SafeMath: addition overflow\");\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the subtraction of two unsigned integers, reverting on\r\n * overflow (when the result is negative).\r\n *\r\n * Counterpart to Solidity's `-` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Subtraction cannot overflow.\r\n */\r\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return sub(a, b, \"SafeMath: subtraction overflow\");\r\n }\r\n\r\n /**\r\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\r\n * overflow (when the result is negative).\r\n *\r\n * Counterpart to Solidity's `-` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Subtraction cannot overflow.\r\n */\r\n function sub(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n require(b <= a, errorMessage);\r\n uint256 c = a - b;\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the multiplication of two unsigned integers, reverting on\r\n * overflow.\r\n *\r\n * Counterpart to Solidity's `*` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Multiplication cannot overflow.\r\n */\r\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\r\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\r\n // benefit is lost if 'b' is also tested.\r\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\r\n if (a == 0) {\r\n return 0;\r\n }\r\n\r\n uint256 c = a * b;\r\n require(c / a == b, \"SafeMath: multiplication overflow\");\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the integer division of two unsigned integers. Reverts on\r\n * division by zero. The result is rounded towards zero.\r\n *\r\n * Counterpart to Solidity's `/` operator. Note: this function uses a\r\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\r\n * uses an invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return div(a, b, \"SafeMath: division by zero\");\r\n }\r\n\r\n /**\r\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\r\n * division by zero. The result is rounded towards zero.\r\n *\r\n * Counterpart to Solidity's `/` operator. Note: this function uses a\r\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\r\n * uses an invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function div(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n require(b > 0, errorMessage);\r\n uint256 c = a / b;\r\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\r\n * Reverts when dividing by zero.\r\n *\r\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\r\n * opcode (which leaves remaining gas untouched) while Solidity uses an\r\n * invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return mod(a, b, \"SafeMath: modulo by zero\");\r\n }\r\n\r\n /**\r\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\r\n * Reverts with custom message when dividing by zero.\r\n *\r\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\r\n * opcode (which leaves remaining gas untouched) while Solidity uses an\r\n * invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function mod(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n require(b != 0, errorMessage);\r\n return a % b;\r\n }\r\n\r\n // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)\r\n function sqrrt(uint256 a) internal pure returns (uint256 c) {\r\n if (a > 3) {\r\n c = a;\r\n uint256 b = add(div(a, 2), 1);\r\n while (b < c) {\r\n c = b;\r\n b = div(add(div(a, b), b), 2);\r\n }\r\n } else if (a != 0) {\r\n c = 1;\r\n }\r\n }\r\n\r\n /*\r\n * Expects percentage to be trailed by 00,\r\n */\r\n function percentageAmount(uint256 total_, uint8 percentage_) internal pure returns (uint256 percentAmount_) {\r\n return div(mul(total_, percentage_), 1000);\r\n }\r\n\r\n /*\r\n * Expects percentage to be trailed by 00,\r\n */\r\n function substractPercentage(uint256 total_, uint8 percentageToSub_) internal pure returns (uint256 result_) {\r\n return sub(total_, div(mul(total_, percentageToSub_), 1000));\r\n }\r\n\r\n function percentageOfTotal(uint256 part_, uint256 total_) internal pure returns (uint256 percent_) {\r\n return div(mul(part_, 100), total_);\r\n }\r\n\r\n /**\r\n * Taken from Hypersonic https://github.com/M2629/HyperSonic/blob/main/Math.sol\r\n * @dev Returns the average of two numbers. The result is rounded towards\r\n * zero.\r\n */\r\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\r\n // (a + b) / 2 can overflow, so we distribute\r\n return (a / 2) + (b / 2) + (((a % 2) + (b % 2)) / 2);\r\n }\r\n\r\n function quadraticPricing(uint256 payment_, uint256 multiplier_) internal pure returns (uint256) {\r\n return sqrrt(mul(multiplier_, payment_));\r\n }\r\n\r\n function bondingCurve(uint256 supply_, uint256 multiplier_) internal pure returns (uint256) {\r\n return mul(multiplier_, supply_);\r\n }\r\n}\r\n"
|
|
},
|
|
"src/Theopetra/TheopetraERC20.sol": {
|
|
"content": "// SPDX-License-Identifier: AGPL-3.0\r\npragma solidity 0.7.5;\r\n\r\nimport \"../Types/ERC20Permit.sol\";\r\nimport \"../Types/ERC20.sol\";\r\nimport \"../Types/TheopetraAccessControlled.sol\";\r\n\r\nimport \"../Libraries/SafeMath.sol\";\r\n\r\ncontract TheopetraERC20Token is ERC20Permit, TheopetraAccessControlled {\r\n using SafeMath for uint256;\r\n\r\n event UpdateMintLimit(uint256 mintLimit);\r\n\r\n uint256 private _initialSupply;\r\n uint256 private _mintLimit;\r\n\r\n constructor(address _authority)\r\n ERC20(\"Theopetra\", \"THEO\", 9)\r\n TheopetraAccessControlled(ITheopetraAuthority(_authority))\r\n {}\r\n\r\n function getInitialSupply() public view returns (uint256) {\r\n return _initialSupply;\r\n }\r\n\r\n function setMintLimit(uint256 limit) public onlyGuardian {\r\n _mintLimit = limit;\r\n emit UpdateMintLimit(limit);\r\n }\r\n\r\n /** @dev If `_initialSupply` is not zero, the amount to mint is\r\n * limited to at most 5% of `_initialSupply`.\r\n *\r\n * The first time mint is successfully called, it will update the `_initialSupply`\r\n * to equal the mint `amount_`\r\n *\r\n * Note _initialSupply is initialized to zero\r\n */\r\n function mint(address account_, uint256 amount_) external onlyVault {\r\n uint256 amount = amount_;\r\n if (_initialSupply == 0) {\r\n _initialSupply = amount_;\r\n _mintLimit = _initialSupply;\r\n } else if (_initialSupply != 0 && amount_ > _mintLimit) {\r\n amount = _mintLimit;\r\n }\r\n _mint(account_, amount);\r\n }\r\n\r\n function burn(uint256 amount) external virtual {\r\n _burn(msg.sender, amount);\r\n }\r\n\r\n function burnFrom(address account_, uint256 amount_) external virtual {\r\n _burnFrom(account_, amount_);\r\n }\r\n\r\n function _burnFrom(address account_, uint256 amount_) public virtual {\r\n uint256 decreasedAllowance_ = allowance(account_, msg.sender).sub(\r\n amount_,\r\n \"ERC20: burn amount exceeds allowance\"\r\n );\r\n\r\n _approve(account_, msg.sender, decreasedAllowance_);\r\n _burn(account_, amount_);\r\n }\r\n}\r\n"
|
|
},
|
|
"src/Types/ERC20.sol": {
|
|
"content": "// SPDX-License-Identifier: AGPL-3.0-or-later\r\npragma solidity >=0.7.5;\r\n\r\nimport \"../Libraries/SafeMath.sol\";\r\n\r\nimport \"../Interfaces/IERC20.sol\";\r\n\r\nabstract contract ERC20 is IERC20 {\r\n using SafeMath for uint256;\r\n\r\n // TODO comment actual hash value.\r\n bytes32 private constant ERC20TOKEN_ERC1820_INTERFACE_ID = keccak256(\"ERC20Token\");\r\n\r\n mapping(address => uint256) internal _balances;\r\n\r\n mapping(address => mapping(address => uint256)) internal _allowances;\r\n\r\n uint256 internal _totalSupply;\r\n\r\n string internal _name;\r\n\r\n string internal _symbol;\r\n\r\n uint8 internal immutable _decimals;\r\n\r\n constructor(\r\n string memory name_,\r\n string memory symbol_,\r\n uint8 decimals_\r\n ) {\r\n _name = name_;\r\n _symbol = symbol_;\r\n _decimals = decimals_;\r\n }\r\n\r\n function name() public view returns (string memory) {\r\n return _name;\r\n }\r\n\r\n function symbol() public view returns (string memory) {\r\n return _symbol;\r\n }\r\n\r\n function decimals() public view virtual returns (uint8) {\r\n return _decimals;\r\n }\r\n\r\n function totalSupply() public view override returns (uint256) {\r\n return _totalSupply;\r\n }\r\n\r\n function balanceOf(address account) public view virtual override returns (uint256) {\r\n return _balances[account];\r\n }\r\n\r\n function transfer(address recipient, uint256 amount) external virtual override returns (bool) {\r\n _transfer(msg.sender, recipient, amount);\r\n return true;\r\n }\r\n\r\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\r\n return _allowances[owner][spender];\r\n }\r\n\r\n function approve(address spender, uint256 amount) external virtual override returns (bool) {\r\n _approve(msg.sender, spender, amount);\r\n return true;\r\n }\r\n\r\n function transferFrom(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) external virtual override returns (bool) {\r\n _transfer(sender, recipient, amount);\r\n _approve(\r\n sender,\r\n msg.sender,\r\n _allowances[sender][msg.sender].sub(amount, \"ERC20: transfer amount exceeds allowance\")\r\n );\r\n return true;\r\n }\r\n\r\n function increaseAllowance(address spender, uint256 addedValue) external virtual returns (bool) {\r\n _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));\r\n return true;\r\n }\r\n\r\n function decreaseAllowance(address spender, uint256 subtractedValue) external virtual returns (bool) {\r\n _approve(\r\n msg.sender,\r\n spender,\r\n _allowances[msg.sender][spender].sub(subtractedValue, \"ERC20: decreased allowance below zero\")\r\n );\r\n return true;\r\n }\r\n\r\n function _transfer(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) internal virtual {\r\n require(sender != address(0), \"ERC20: transfer from the zero address\");\r\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\r\n\r\n _beforeTokenTransfer(sender, recipient, amount);\r\n\r\n _balances[sender] = _balances[sender].sub(amount, \"ERC20: transfer amount exceeds balance\");\r\n _balances[recipient] = _balances[recipient].add(amount);\r\n emit Transfer(sender, recipient, amount);\r\n }\r\n\r\n function _mint(address account, uint256 amount) internal virtual {\r\n require(account != address(0), \"ERC20: mint to the zero address\");\r\n _beforeTokenTransfer(address(0), account, amount);\r\n _totalSupply = _totalSupply.add(amount);\r\n _balances[account] = _balances[account].add(amount);\r\n emit Transfer(address(0), account, amount);\r\n }\r\n\r\n function _burn(address account, uint256 amount) internal virtual {\r\n require(account != address(0), \"ERC20: burn from the zero address\");\r\n\r\n _beforeTokenTransfer(account, address(0), amount);\r\n\r\n _balances[account] = _balances[account].sub(amount, \"ERC20: burn amount exceeds balance\");\r\n _totalSupply = _totalSupply.sub(amount);\r\n emit Transfer(account, address(0), amount);\r\n }\r\n\r\n function _approve(\r\n address owner,\r\n address spender,\r\n uint256 amount\r\n ) internal virtual {\r\n require(owner != address(0), \"ERC20: approve from the zero address\");\r\n require(spender != address(0), \"ERC20: approve to the zero address\");\r\n\r\n _allowances[owner][spender] = amount;\r\n emit Approval(owner, spender, amount);\r\n }\r\n\r\n function _beforeTokenTransfer(\r\n address from_,\r\n address to_,\r\n uint256 amount_\r\n ) internal virtual {}\r\n}\r\n"
|
|
},
|
|
"src/Types/ERC20Permit.sol": {
|
|
"content": "// SPDX-License-Identifier: AGPL-3.0-or-later\r\npragma solidity 0.7.5;\r\n\r\nimport \"./ERC20.sol\";\r\nimport \"../Interfaces/IERC2612Permit.sol\";\r\nimport \"../Libraries/Counters.sol\";\r\n\r\nabstract contract ERC20Permit is ERC20, IERC2612Permit {\r\n using Counters for Counters.Counter;\r\n\r\n mapping(address => Counters.Counter) private _nonces;\r\n\r\n // keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\r\n bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;\r\n\r\n /**\r\n * @dev See {IERC2612Permit-permit}.\r\n *\r\n */\r\n function permit(\r\n address owner,\r\n address spender,\r\n uint256 amount,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) external virtual override {\r\n require(block.timestamp <= deadline, \"Permit: expired deadline\");\r\n uint256 chainID;\r\n assembly {\r\n chainID := chainid()\r\n }\r\n\r\n bytes32 hashStruct = keccak256(\r\n abi.encode(PERMIT_TYPEHASH, owner, spender, amount, _nonces[owner].current(), deadline)\r\n );\r\n\r\n bytes32 _hash = keccak256(abi.encodePacked(uint16(0x1901),\r\n keccak256(\r\n abi.encode(\r\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\r\n keccak256(bytes(name())),\r\n keccak256(bytes(\"1\")), // Version\r\n chainID,\r\n address(this)\r\n )\r\n ), hashStruct));\r\n\r\n require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, \"invalid signature 's' value\");\r\n require(v == 27 || v == 28, \"invalid signature 'v' value\");\r\n\r\n address signer = ecrecover(_hash, v, r, s);\r\n require(signer != address(0) && signer == owner, \"ZeroSwapPermit: Invalid signature\");\r\n\r\n _nonces[owner].increment();\r\n _approve(owner, spender, amount);\r\n }\r\n\r\n /**\r\n * @dev See {IERC2612Permit-nonces}.\r\n */\r\n function nonces(address owner) external view override returns (uint256) {\r\n return _nonces[owner].current();\r\n }\r\n}\r\n"
|
|
},
|
|
"src/Types/TheopetraAccessControlled.sol": {
|
|
"content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity >=0.7.5;\r\n\r\nimport \"../Interfaces/ITheopetraAuthority.sol\";\r\n\r\nabstract contract TheopetraAccessControlled {\r\n /* ========== EVENTS ========== */\r\n\r\n event AuthorityUpdated(ITheopetraAuthority indexed authority);\r\n\r\n string constant UNAUTHORIZED = \"UNAUTHORIZED\"; // save gas\r\n\r\n /* ========== STATE VARIABLES ========== */\r\n\r\n ITheopetraAuthority public authority;\r\n\r\n /* ========== Constructor ========== */\r\n\r\n constructor(ITheopetraAuthority _authority) {\r\n authority = _authority;\r\n emit AuthorityUpdated(_authority);\r\n }\r\n\r\n /* ========== MODIFIERS ========== */\r\n\r\n modifier onlyGovernor() {\r\n require(msg.sender == authority.governor(), UNAUTHORIZED);\r\n _;\r\n }\r\n\r\n modifier onlyGuardian() {\r\n require(msg.sender == authority.guardian(), UNAUTHORIZED);\r\n _;\r\n }\r\n\r\n modifier onlyPolicy() {\r\n require(msg.sender == authority.policy(), UNAUTHORIZED);\r\n _;\r\n }\r\n\r\n modifier onlyManager() {\r\n require(msg.sender == authority.manager(), UNAUTHORIZED);\r\n _;\r\n }\r\n\r\n modifier onlyVault() {\r\n require(msg.sender == authority.vault(), UNAUTHORIZED);\r\n _;\r\n }\r\n\r\n /* ========== GOV ONLY ========== */\r\n\r\n function setAuthority(ITheopetraAuthority _newAuthority) external onlyGovernor {\r\n authority = _newAuthority;\r\n emit AuthorityUpdated(_newAuthority);\r\n }\r\n}\r\n"
|
|
}
|
|
}
|
|
} |