UNPKG

jcc-solidity-utils

Version:
1,007 lines 204 kB
{ "contractName": "Administrative", "abi": [ { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "previousOwner", "type": "address" }, { "indexed": true, "name": "newOwner", "type": "address" } ], "name": "OwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "previousAdmin", "type": "address" }, { "indexed": true, "name": "newAdmin", "type": "address" } ], "name": "AdministratorTransferred", "type": "event" }, { "constant": false, "inputs": [], "name": "renounceOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "newAdmin", "type": "address" } ], "name": "transferAdministrator", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "owner", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "admin", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.4.24+commit.e67f0147\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"transferAdministrator\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdministratorTransferred\",\"type\":\"event\"}],\"devdoc\":{\"methods\":{\"renounceOwnership()\":{\"details\":\"\\u653e\\u5f03\\u5408\\u7ea6\\u7684\\u6240\\u6709\\u6743\\uff0c\\u6ce8\\u610f\\uff0c\\u5408\\u7ea6\\u6ca1\\u6709\\u4efb\\u4f55\\u4eba\\u53ef\\u4ee5\\u62e5\\u6709\\u4e86\\uff0c\\u90a3\\u4e48\\u5f88\\u591a\\u62e5\\u6709\\u8005\\u5e94\\u8be5\\u6709\\u7684\\u80fd\\u529b\\uff0c\\u90fd\\u4e0d\\u80fd\\u8bbf\\u95ee\\u4e86\"}}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/owner/Administrative.sol\":\"Administrative\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/owner/Administrative.sol\":{\"keccak256\":\"0xca1f191b7611b7fec06b5c299eaf62dcca56dbbf9f6e3d3eaa7114466df35440\",\"urls\":[\"bzzr://74c8c8a8d3e19a60d6bfe9c7dc3b4c4b037876d5fc4b842ddce6c894e3f0f575\"]}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b506000805433600160a060020a0319918216811780845560018054909316909117909155604051600160a060020a0390911691907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3600154604051600160a060020a03909116906000907f399b55200f7f639a63d76efe3dcfa9156ce367058d6b673041b84a628885f5a7908290a36104f1806100b26000396000f30060806040526004361061006c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663715018a681146100715780638da5cb5b14610088578063c648a3a2146100b9578063f2fde38b146100da578063f851a440146100fb575b600080fd5b34801561007d57600080fd5b50610086610110565b005b34801561009457600080fd5b5061009d6101c9565b60408051600160a060020a039092168252519081900360200190f35b3480156100c557600080fd5b50610086600160a060020a03600435166101d8565b3480156100e657600080fd5b50610086600160a060020a0360043516610366565b34801561010757600080fd5b5061009d6104b6565b600054600160a060020a03163314610172576040805160e560020a62461bcd02815260206004820152601a60248201527f6f6e6c79206f776e65722063616e206d6f646966792074686973000000000000604482015290519081900360640190fd5b60008054604051600160a060020a03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a031690565b600054600160a060020a03163314806101fb5750600154600160a060020a031633145b1515610277576040805160e560020a62461bcd02815260206004820152602b60248201527f6f6e6c79206f776e6572206f722061646d696e6973747261746f722063616e2060448201527f6d6f646966792074686973000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a03811615156102fd576040805160e560020a62461bcd02815260206004820152602e60248201527f43616e206e6f74207472616e736665722061646d696e6973747261746f72207460448201527f6f207a65726f2061646472657373000000000000000000000000000000000000606482015290519081900360840190fd5b600154604051600160a060020a038084169216907f399b55200f7f639a63d76efe3dcfa9156ce367058d6b673041b84a628885f5a790600090a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a031633146103c8576040805160e560020a62461bcd02815260206004820152601a60248201527f6f6e6c79206f776e65722063616e206d6f646966792074686973000000000000604482015290519081900360640190fd5b600160a060020a038116151561044e576040805160e560020a62461bcd02815260206004820152602660248201527f43616e206e6f74207472616e73666572206f776e657220746f207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600154600160a060020a0316905600a165627a7a723058200f0943204997312a624fc8afee3c147d9f361d898fca93dc7a1c2156ec019f130029", "deployedBytecode": "0x60806040526004361061006c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663715018a681146100715780638da5cb5b14610088578063c648a3a2146100b9578063f2fde38b146100da578063f851a440146100fb575b600080fd5b34801561007d57600080fd5b50610086610110565b005b34801561009457600080fd5b5061009d6101c9565b60408051600160a060020a039092168252519081900360200190f35b3480156100c557600080fd5b50610086600160a060020a03600435166101d8565b3480156100e657600080fd5b50610086600160a060020a0360043516610366565b34801561010757600080fd5b5061009d6104b6565b600054600160a060020a03163314610172576040805160e560020a62461bcd02815260206004820152601a60248201527f6f6e6c79206f776e65722063616e206d6f646966792074686973000000000000604482015290519081900360640190fd5b60008054604051600160a060020a03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a031690565b600054600160a060020a03163314806101fb5750600154600160a060020a031633145b1515610277576040805160e560020a62461bcd02815260206004820152602b60248201527f6f6e6c79206f776e6572206f722061646d696e6973747261746f722063616e2060448201527f6d6f646966792074686973000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a03811615156102fd576040805160e560020a62461bcd02815260206004820152602e60248201527f43616e206e6f74207472616e736665722061646d696e6973747261746f72207460448201527f6f207a65726f2061646472657373000000000000000000000000000000000000606482015290519081900360840190fd5b600154604051600160a060020a038084169216907f399b55200f7f639a63d76efe3dcfa9156ce367058d6b673041b84a628885f5a790600090a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a031633146103c8576040805160e560020a62461bcd02815260206004820152601a60248201527f6f6e6c79206f776e65722063616e206d6f646966792074686973000000000000604482015290519081900360640190fd5b600160a060020a038116151561044e576040805160e560020a62461bcd02815260206004820152602660248201527f43616e206e6f74207472616e73666572206f776e657220746f207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600154600160a060020a0316905600a165627a7a723058200f0943204997312a624fc8afee3c147d9f361d898fca93dc7a1c2156ec019f130029", "sourceMap": "752:1854:30:-;;;1115:182;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1142:6:30;:19;;1151:10;-1:-1:-1;;;;;;1142:19:30;;;;;;;;-1:-1:-1;1167:19:30;;;;;;;;;;;1197:40;;-1:-1:-1;;;;;1230:6:30;;;;1142;1197:40;;1142:6;;1197:40;1285:6;;1248:44;;-1:-1:-1;;;;;1285:6:30;;;;;;1248:44;;1285:6;;1248:44;752:1854;;;;;;", "deployedSourceMap": "752:1854:30:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1844:127;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1844:127:30;;;;;;2458:71;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2458:71:30;;;;;;;;-1:-1:-1;;;;;2458:71:30;;;;;;;;;;;;;;2197:257;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2197:257:30;-1:-1:-1;;;;;2197:257:30;;;;;1975:218;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1975:218:30;-1:-1:-1;;;;;1975:218:30;;;;;2533:71;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2533:71:30;;;;1844:127;1350:6;;-1:-1:-1;;;;;1350:6:30;1336:10;:20;1328:59;;;;;-1:-1:-1;;;;;1328:59:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;1938:1;1922:6;;1901:40;;-1:-1:-1;;;;;1922:6:30;;;;1901:40;;1938:1;;1901:40;1964:1;1947:19;;-1:-1:-1;;1947:19:30;;;1844:127::o;2458:71::-;2496:7;2518:6;-1:-1:-1;;;;;2518:6:30;2458:71;:::o;2197:257::-;1581:6;;-1:-1:-1;;;;;1581:6:30;1567:10;:20;;1566:48;;-1:-1:-1;1607:6:30;;-1:-1:-1;;;;;1607:6:30;1593:10;:20;1566:48;1551:122;;;;;;;-1:-1:-1;;;;;1551:122:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;2289:22:30;;;;2274:99;;;;;-1:-1:-1;;;;;2274:99:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2409:6;;2384:42;;-1:-1:-1;;;;;2384:42:30;;;;2409:6;;2384:42;;2409:6;;2384:42;2432:6;:17;;-1:-1:-1;;2432:17:30;-1:-1:-1;;;;;2432:17:30;;;;;;;;;;2197:257::o;1975:218::-;1350:6;;-1:-1:-1;;;;;1350:6:30;1336:10;:20;1328:59;;;;;-1:-1:-1;;;;;1328:59:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;2051:22:30;;;;2043:73;;;;;-1:-1:-1;;;;;2043:73:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2148:6;;;2127:38;;-1:-1:-1;;;;;2127:38:30;;;;2148:6;;;2127:38;;;2171:6;:17;;-1:-1:-1;;2171:17:30;-1:-1:-1;;;;;2171:17:30;;;;;;;;;;1975:218::o;2533:71::-;2593:6;;-1:-1:-1;;;;;2593:6:30;2533:71;:::o", "source": "pragma solidity >=0.4.24;\n\n/**\n@dev Administrative 为合约提供控制权限,可以通过继承该合约的方式获得这些功能\n`onlyOwner` 这样的 modifier 可以在合约中使用,通常用来表达所有权\n`onlyAdministrator` 用来表达运行经营权力,和所有权分开,这样的设计可以满足项目资产拥有者和经营者进行区分的场合\n无论是拥有者还是经营者,都可以是一个多签名的合约钱包,用投票方式决定权利的转移\n建议使用的场景:\n1. 拥有者是最后的裁决者,可以决定经营者和拥有者任免,也能决定合约自杀后的资金转移\n2. 经营者可以就业务中各种情况进行决策,根据授权决定资金转移和经营者变更\n */\ncontract Administrative {\n address private _owner;\n address private _admin;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n event AdministratorTransferred(\n address indexed previousAdmin,\n address indexed newAdmin\n );\n\n /**\n @dev 初始化合约时,部署合约的账户自动成为owner\n */\n constructor() public {\n _owner = msg.sender;\n _admin = msg.sender;\n emit OwnershipTransferred(address(0), _owner);\n emit AdministratorTransferred(address(0), _admin);\n }\n\n modifier onlyOwner() {\n require(msg.sender == _owner, \"only owner can modify this\");\n _;\n }\n\n modifier onlyAdministrator {\n require(msg.sender == _admin, \"only administrator can modify this\");\n _;\n }\n\n modifier onlyPrivileged() {\n require(\n (msg.sender == _owner) || (msg.sender == _admin),\n \"only owner or administrator can modify this\"\n );\n _;\n }\n\n /**\n @dev 放弃合约的所有权,注意,合约没有任何人可以拥有了,那么很多拥有者应该有的能力,都不能访问了\n */\n function renounceOwnership() public onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n require(newOwner != address(0), \"Can not transfer owner to zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n\n function transferAdministrator(address newAdmin) public onlyPrivileged {\n require(\n newAdmin != address(0),\n \"Can not transfer administrator to zero address\"\n );\n emit AdministratorTransferred(_admin, newAdmin);\n _admin = newAdmin;\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n function admin() public view returns (address) {\n return _admin;\n }\n}\n", "sourcePath": "/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/owner/Administrative.sol", "ast": { "absolutePath": "/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/owner/Administrative.sol", "exportedSymbols": { "Administrative": [ 6730 ] }, "id": 6731, "nodeType": "SourceUnit", "nodes": [ { "id": 6555, "literals": [ "solidity", ">=", "0.4", ".24" ], "nodeType": "PragmaDirective", "src": "0:25:30" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": "@dev Administrative 为合约提供控制权限,可以通过继承该合约的方式获得这些功能\n`onlyOwner` 这样的 modifier 可以在合约中使用,通常用来表达所有权\n`onlyAdministrator` 用来表达运行经营权力,和所有权分开,这样的设计可以满足项目资产拥有者和经营者进行区分的场合\n无论是拥有者还是经营者,都可以是一个多签名的合约钱包,用投票方式决定权利的转移\n建议使用的场景:\n1. 拥有者是最后的裁决者,可以决定经营者和拥有者任免,也能决定合约自杀后的资金转移\n2. 经营者可以就业务中各种情况进行决策,根据授权决定资金转移和经营者变更", "fullyImplemented": true, "id": 6730, "linearizedBaseContracts": [ 6730 ], "name": "Administrative", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 6557, "name": "_owner", "nodeType": "VariableDeclaration", "scope": 6730, "src": "780:22:30", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 6556, "name": "address", "nodeType": "ElementaryTypeName", "src": "780:7:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "private" }, { "constant": false, "id": 6559, "name": "_admin", "nodeType": "VariableDeclaration", "scope": 6730, "src": "806:22:30", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 6558, "name": "address", "nodeType": "ElementaryTypeName", "src": "806:7:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "private" }, { "anonymous": false, "documentation": null, "id": 6565, "name": "OwnershipTransferred", "nodeType": "EventDefinition", "parameters": { "id": 6564, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 6561, "indexed": true, "name": "previousOwner", "nodeType": "VariableDeclaration", "scope": 6565, "src": "865:29:30", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 6560, "name": "address", "nodeType": "ElementaryTypeName", "src": "865:7:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 6563, "indexed": true, "name": "newOwner", "nodeType": "VariableDeclaration", "scope": 6565, "src": "900:24:30", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 6562, "name": "address", "nodeType": "ElementaryTypeName", "src": "900:7:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "859:69:30" }, "src": "833:96:30" }, { "anonymous": false, "documentation": null, "id": 6571, "name": "AdministratorTransferred", "nodeType": "EventDefinition", "parameters": { "id": 6570, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 6567, "indexed": true, "name": "previousAdmin", "nodeType": "VariableDeclaration", "scope": 6571, "src": "968:29:30", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 6566, "name": "address", "nodeType": "ElementaryTypeName", "src": "968:7:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 6569, "indexed": true, "name": "newAdmin", "nodeType": "VariableDeclaration", "scope": 6571, "src": "1003:24:30", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 6568, "name": "address", "nodeType": "ElementaryTypeName", "src": "1003:7:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "962:69:30" }, "src": "932:100:30" }, { "body": { "id": 6598, "nodeType": "Block", "src": "1136:161:30", "statements": [ { "expression": { "argumentTypes": null, "id": 6577, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 6574, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6557, "src": "1142:6:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 6575, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9041, "src": "1151:3:30", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 6576, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1151:10:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1142:19:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 6578, "nodeType": "ExpressionStatement", "src": "1142:19:30" }, { "expression": { "argumentTypes": null, "id": 6582, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 6579, "name": "_admin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6559, "src": "1167:6:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 6580, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9041, "src": "1176:3:30", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 6581, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1176:10:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1167:19:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 6583, "nodeType": "ExpressionStatement", "src": "1167:19:30" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 6586, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1226:1:30", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 6585, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1218:7:30", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 6587, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1218:10:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 6588, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6557, "src": "1230:6:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 6584, "name": "OwnershipTransferred", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6565, "src": "1197:20:30", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address)" } }, "id": 6589, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1197:40:30", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 6590, "nodeType": "EmitStatement", "src": "1192:45:30" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 6593, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1281:1:30", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 6592, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1273:7:30", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 6594, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1273:10:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 6595, "name": "_admin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6559, "src": "1285:6:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 6591, "name": "AdministratorTransferred", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6571, "src": "1248:24:30", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address)" } }, "id": 6596, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1248:44:30", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 6597, "nodeType": "EmitStatement", "src": "1243:49:30" } ] }, "documentation": "@dev 初始化合约时,部署合约的账户自动成为owner", "id": 6599, "implemented": true, "isConstructor": true, "isDeclaredConst": false, "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 6572, "nodeType": "ParameterList", "parameters": [], "src": "1126:2:30" }, "payable": false, "returnParameters": { "id": 6573, "nodeType": "ParameterList", "parameters": [], "src": "1136:0:30" }, "scope": 6730, "src": "1115:182:30", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 6610, "nodeType": "Block", "src": "1322:77:30", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 6605, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 6602, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9041, "src": "1336:3:30", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 6603, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1336:10:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 6604, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6557, "src": "1350:6:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1336:20:30", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "6f6e6c79206f776e65722063616e206d6f646966792074686973", "id": 6606, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1358:28:30", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_355ac0e17d6a565ff88bb4c97cca20076bb1a3cc93c51e8ecadf7ae23a7ac293", "typeString": "literal_string \"only owner can modify this\"" }, "value": "only owner can modify this" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_355ac0e17d6a565ff88bb4c97cca20076bb1a3cc93c51e8ecadf7ae23a7ac293", "typeString": "literal_string \"only owner can modify this\"" } ], "id": 6601, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 9044, 9045 ], "referencedDeclaration": 9045, "src": "1328:7:30", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 6607, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1328:59:30", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 6608, "nodeType": "ExpressionStatement", "src": "1328:59:30" }, { "id": 6609, "nodeType": "PlaceholderStatement", "src": "1393:1:30" } ] }, "documentation": null, "id": 6611, "name": "onlyOwner", "nodeType": "ModifierDefinition", "parameters": { "id": 6600, "nodeType": "ParameterList", "parameters": [], "src": "1319:2:30" }, "src": "1301:98:30", "visibility": "internal" }, { "body": { "id": 6622, "nodeType": "Block", "src": "1430:85:30", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 6617, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 6614, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9041, "src": "1444:3:30", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 6615, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1444:10:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 6616, "name": "_admin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6559, "src": "1458:6:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1444:20:30", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "6f6e6c792061646d696e6973747261746f722063616e206d6f646966792074686973", "id": 6618, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1466:36:30", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_49e3f0e75cbf97bb6014b9372398174d905b913f6943ced801184a38efcde7c1", "typeString": "literal_string \"only administrator can modify this\"" }, "value": "only administrator can modify this" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_49e3f0e75cbf97bb6014b9372398174d905b913f6943ced801184a38efcde7c1", "typeString": "literal_string \"only administrator can modify this\"" } ], "id": 6613, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 9044, 9045 ], "referencedDeclaration": 9045, "src": "1436:7:30", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 6619, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1436:67:30", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()"