UNPKG

@daostack/upgrades

Version:
1,167 lines 90.4 kB
{ "fileName": "BaseAdminUpgradeabilityProxy.sol", "contractName": "BaseAdminUpgradeabilityProxy", "source": "pragma solidity ^0.6.0;\n// SPDX-License-Identifier: MIT\n\nimport './UpgradeabilityProxy.sol';\n\n/**\n * @title BaseAdminUpgradeabilityProxy\n * @dev This contract combines an upgradeability proxy with an authorization\n * mechanism for administrative tasks.\n * All external functions in this contract must be guarded by the\n * `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity\n * feature proposal that would enable this to be done automatically.\n */\ncontract BaseAdminUpgradeabilityProxy is BaseUpgradeabilityProxy {\n /**\n * @dev Emitted when the administration has been transferred.\n * @param previousAdmin Address of the previous admin.\n * @param newAdmin Address of the new admin.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n\n bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Modifier to check whether the `msg.sender` is the admin.\n * If it is, it will run the function. Otherwise, it will delegate the call\n * to the implementation.\n */\n modifier ifAdmin() {\n if (msg.sender == _admin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @return The address of the proxy admin.\n */\n function admin() external ifAdmin returns (address) {\n return _admin();\n }\n\n /**\n * @return The address of the implementation.\n */\n function implementation() external ifAdmin returns (address) {\n return _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n * Only the current admin can call this function.\n * @param newAdmin Address to transfer proxy administration to.\n */\n function changeAdmin(address newAdmin) external ifAdmin {\n require(newAdmin != address(0), \"Cannot change the admin of a proxy to the zero address\");\n emit AdminChanged(_admin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the backing implementation of the proxy.\n * Only the admin can call this function.\n * @param newImplementation Address of the new implementation.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeTo(newImplementation);\n }\n\n /**\n * @dev Upgrade the backing implementation of the proxy and call a function\n * on the new implementation.\n * This is useful to initialize the proxied contract.\n * @param newImplementation Address of the new implementation.\n * @param data Data to send as msg.data in the low level call.\n * It should include the signature and the parameters of the function to be called, as described in\n * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {\n _upgradeTo(newImplementation);\n (bool success,) = newImplementation.delegatecall(data);\n require(success);\n }\n\n /**\n * @return adm The admin slot.\n */\n function _admin() internal view returns (address adm) {\n bytes32 slot = ADMIN_SLOT;\n assembly {\n adm := sload(slot)\n }\n }\n\n /**\n * @dev Sets the address of the proxy admin.\n * @param newAdmin Address of the new proxy admin.\n */\n function _setAdmin(address newAdmin) internal {\n bytes32 slot = ADMIN_SLOT;\n\n assembly {\n sstore(slot, newAdmin)\n }\n }\n\n // /**\n // * @dev Only fall back when the sender is not the admin.\n // */\n // function _willFallback() internal override {\n // require(msg.sender != _admin(), \"Cannot call fallback function from the proxy admin\");\n // super._willFallback();\n // }\n}\n", "sourcePath": "contracts/upgradeability/BaseAdminUpgradeabilityProxy.sol", "sourceMap": "457:3320:35:-:0;;;;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "457:3320:35:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;514:50:39;548:11;:9;:11;;:::i;:::-;514:50;457:3320:35;;459:51:39;494:11;:9;:11;;:::i;:::-;459:51;457:3320:35;2238:103;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;2858:221;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;1558:96;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1830:224;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;1416:78;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;2075:90:39;2111:15;:13;:15;;:::i;:::-;2132:28;2142:17;:15;:17;;:::i;:::-;2132:9;:28;;:::i;:::-;2075:90;:::o;2238:103:35:-;1293:8;:6;:8;;:::i;:::-;1279:22;;:10;:22;;;1275:76;;;2307:29:::1;2318:17;2307:10;:29;;:::i;:::-;1311:1;1275:76:::0;;;1333:11;:9;:11;;:::i;:::-;1275:76;2238:103;;:::o;2858:221::-;1293:8;:6;:8;;:::i;:::-;1279:22;;:10;:22;;;1275:76;;;2963:29:::1;2974:17;2963:10;:29;;:::i;:::-;2999:12;3016:17;:30;;3047:4;;3016:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2998:54;;;3066:7;3058:16;;;;;;;;1311:1;;1275:76:::0;;;1333:11;:9;:11;;:::i;:::-;1275:76;2858:221;;;;:::o;1558:96::-;1610:7;1293:8;:6;:8;;:::i;:::-;1279:22;;:10;:22;;;1275:76;;;1632:17:::1;:15;:17;;:::i;:::-;1625:24;;;;1311:1;1275:76:::0;;;1333:11;:9;:11;;:::i;:::-;1275:76;1558:96;;:::o;1830:224::-;1293:8;:6;:8;;:::i;:::-;1279:22;;:10;:22;;;1275:76;;;1920:1:::1;1900:22;;:8;:22;;;;1892:89;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1992:32;2005:8;:6;:8;;:::i;:::-;2015;1992:32;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2030:19;2040:8;2030:9;:19;;:::i;:::-;1311:1;1275:76:::0;;;1333:11;:9;:11;;:::i;:::-;1275:76;1830:224;;:::o;1416:78::-;1459:7;1293:8;:6;:8;;:::i;:::-;1279:22;;:10;:22;;;1275:76;;;1481:8:::1;:6;:8;;:::i;:::-;1474:15;;;;1311:1;1275:76:::0;;;1333:11;:9;:11;;:::i;:::-;1275:76;1416:78;;:::o;1933:47:39:-;;:::o;995:165:36:-;1054:12;1074;810:66;1089:19;;1074:34;;1145:4;1139:11;1131:19;;1123:33;;;:::o;981:743:39:-;1283:14;1280:1;1277;1264:34;1479:1;1476;1460:14;1457:1;1441:14;1434:5;1421:60;1543:16;1540:1;1537;1522:38;1575:6;1635:1;1630:38;;;;1695:16;1692:1;1685:27;1568:146;;1630:38;1649:16;1646:1;1639:27;1568:146;;1048:672;;;:::o;3128:136:35:-;3169:11;3188:12;994:66;3203:10;;3188:25;;3249:4;3243:11;3236:18;;3228:32;;;:::o;1295:142:36:-;1357:37;1376:17;1357:18;:37;;:::i;:::-;1414:17;1405:27;;;;;;;;;;;;1295:142;;:::o;3380:133:35:-;3432:12;994:66;3447:10;;3432:25;;3494:8;3488:4;3481:22;3473:36;;;:::o;1574:305:36:-;1652:57;1691:17;1652:38;:57;;:::i;:::-;1644:129;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1780:12;810:66;1795:19;;1780:34;;1851:17;1845:4;1838:31;1830:45;;;:::o;956:616:43:-;1016:4;1032:12;1531:7;1519:20;1511:28;;1564:1;1557:4;:8;1550:15;;;;;956:616;;;;;:::o", "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "previousAdmin", "type": "address" }, { "indexed": false, "internalType": "address", "name": "newAdmin", "type": "address" } ], "name": "AdminChanged", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "implementation", "type": "address" } ], "name": "Upgraded", "type": "event" }, { "stateMutability": "payable", "type": "fallback" }, { "inputs": [], "name": "admin", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "newAdmin", "type": "address" } ], "name": "changeAdmin", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "implementation", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "newImplementation", "type": "address" } ], "name": "upgradeTo", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "newImplementation", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "upgradeToAndCall", "outputs": [], "stateMutability": "payable", "type": "function" }, { "stateMutability": "payable", "type": "receive" } ], "ast": { "absolutePath": "contracts/upgradeability/BaseAdminUpgradeabilityProxy.sol", "exportedSymbols": { "BaseAdminUpgradeabilityProxy": [ 5999 ] }, "id": 6000, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 5851, "literals": [ "solidity", "^", "0.6", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:35" }, { "absolutePath": "contracts/upgradeability/UpgradeabilityProxy.sol", "file": "./UpgradeabilityProxy.sol", "id": 5852, "nodeType": "ImportDirective", "scope": 6000, "sourceUnit": 6754, "src": "57:35:35", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 5854, "name": "BaseUpgradeabilityProxy", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 6064, "src": "498:23:35", "typeDescriptions": { "typeIdentifier": "t_contract$_BaseUpgradeabilityProxy_$6064", "typeString": "contract BaseUpgradeabilityProxy" } }, "id": 5855, "nodeType": "InheritanceSpecifier", "src": "498:23:35" } ], "contractDependencies": [ 6064, 6257 ], "contractKind": "contract", "documentation": { "id": 5853, "nodeType": "StructuredDocumentation", "src": "94:362:35", "text": " @title BaseAdminUpgradeabilityProxy\n @dev This contract combines an upgradeability proxy with an authorization\n mechanism for administrative tasks.\n All external functions in this contract must be guarded by the\n `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity\n feature proposal that would enable this to be done automatically." }, "fullyImplemented": true, "id": 5999, "linearizedBaseContracts": [ 5999, 6064, 6257 ], "name": "BaseAdminUpgradeabilityProxy", "nodeType": "ContractDefinition", "nodes": [ { "anonymous": false, "documentation": { "id": 5856, "nodeType": "StructuredDocumentation", "src": "526:177:35", "text": " @dev Emitted when the administration has been transferred.\n @param previousAdmin Address of the previous admin.\n @param newAdmin Address of the new admin." }, "id": 5862, "name": "AdminChanged", "nodeType": "EventDefinition", "parameters": { "id": 5861, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5858, "indexed": false, "mutability": "mutable", "name": "previousAdmin", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5862, "src": "725:21:35", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5857, "name": "address", "nodeType": "ElementaryTypeName", "src": "725:7:35", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 5860, "indexed": false, "mutability": "mutable", "name": "newAdmin", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5862, "src": "748:16:35", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5859, "name": "address", "nodeType": "ElementaryTypeName", "src": "748:7:35", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "724:41:35" }, "src": "706:60:35" }, { "constant": true, "documentation": { "id": 5863, "nodeType": "StructuredDocumentation", "src": "770:181:35", "text": " @dev Storage slot with the admin of the contract.\n This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n validated in the constructor." }, "id": 5866, "mutability": "constant", "name": "ADMIN_SLOT", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5999, "src": "955:105:35", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 5864, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "955:7:35", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": { "argumentTypes": null, "hexValue": "307862353331323736383461353638623331373361653133623966386136303136653234336536336236653865653131373864366137313738353062356436313033", "id": 5865, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "994:66:35", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_81955473079516046949633743016697847541294818689821282749996681496272635257091_by_1", "typeString": "int_const 8195...(69 digits omitted)...7091" }, "value": "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103" }, "visibility": "internal" }, { "body": { "id": 5881, "nodeType": "Block", "src": "1269:86:35", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 5873, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 5869, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, "src": "1279:3:35", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 5870, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1279:10:35", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 5871, "name": "_admin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5986, "src": "1293:6:35", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", "typeString": "function () view returns (address)" } }, "id": 5872, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1293:8:35", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1279:22:35", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": { "id": 5879, "nodeType": "Block", "src": "1325:26:35", "statements": [ { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 5876, "name": "_fallback", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6256, "src": "1333:9:35", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", "typeString": "function ()" } }, "id": 5877, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1333:11:35", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 5878, "nodeType": "ExpressionStatement", "src": "1333:11:35" } ] }, "id": 5880, "nodeType": "IfStatement", "src": "1275:76:35", "trueBody": { "id": 5875, "nodeType": "Block", "src": "1303:16:35", "statements": [ { "id": 5874, "nodeType": "PlaceholderStatement", "src": "1311:1:35" } ] } } ] }, "documentation": { "id": 5867, "nodeType": "StructuredDocumentation", "src": "1065:182:35", "text": " @dev Modifier to check whether the `msg.sender` is the admin.\n If it is, it will run the function. Otherwise, it will delegate the call\n to the implementation." }, "id": 5882, "name": "ifAdmin", "nodeType": "ModifierDefinition", "overrides": null, "parameters": { "id": 5868, "nodeType": "ParameterList", "parameters": [], "src": "1266:2:35" }, "src": "1250:105:35", "virtual": false, "visibility": "internal" }, { "body": { "id": 5893, "nodeType": "Block", "src": "1468:26:35", "statements": [ { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 5890, "name": "_admin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5986, "src": "1481:6:35", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", "typeString": "function () view returns (address)" } }, "id": 5891, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1481:8:35", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "functionReturnParameters": 5889, "id": 5892, "nodeType": "Return", "src": "1474:15:35" } ] }, "documentation": { "id": 5883, "nodeType": "StructuredDocumentation", "src": "1359:54:35", "text": " @return The address of the proxy admin." }, "functionSelector": "f851a440", "id": 5894, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 5886, "modifierName": { "argumentTypes": null, "id": 5885, "name": "ifAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5882, "src": "1442:7:35", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1442:7:35" } ], "name": "admin", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 5884, "nodeType": "ParameterList", "parameters": [], "src": "1430:2:35" }, "returnParameters": { "id": 5889, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5888, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5894, "src": "1459:7:35", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5887, "name": "address", "nodeType": "ElementaryTypeName", "src": "1459:7:35", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1458:9:35" }, "scope": 5999, "src": "1416:78:35", "stateMutability": "nonpayable", "virtual": false, "visibility": "external" }, { "body": { "id": 5905, "nodeType": "Block", "src": "1619:35:35", "statements": [ { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 5902, "name": "_implementation", "nodeType": "Identifier", "overloadedDeclarations": [ 6028 ], "referencedDeclaration": 6028, "src": "1632:15:35", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", "typeString": "function () view returns (address)" } }, "id": 5903, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1632:17:35", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "functionReturnParameters": 5901, "id": 5904, "nodeType": "Return", "src": "1625:24:35" } ] }, "documentation": { "id": 5895, "nodeType": "StructuredDocumentation", "src": "1498:57:35", "text": " @return The address of the implementation." }, "functionSelector": "5c60da1b", "id": 5906, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 5898, "modifierName": { "argumentTypes": null, "id": 5897, "name": "ifAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5882, "src": "1593:7:35", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1593:7:35" } ], "name": "implementation", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 5896, "nodeType": "ParameterList", "parameters": [], "src": "1581:2:35" }, "returnParameters": { "id": 5901, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5900, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5906, "src": "1610:7:35", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5899, "name": "address", "nodeType": "ElementaryTypeName", "src": "1610:7:35", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1609:9:35" }, "scope": 5999, "src": "1558:96:35", "stateMutability": "nonpayable", "virtual": false, "visibility": "external" }, { "body": { "id": 5934, "nodeType": "Block", "src": "1886:168:35", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 5920, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 5915, "name": "newAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5909, "src": "1900:8:35", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 5918, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1920:1:35", "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": 5917, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1912:7:35", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 5916, "name": "address", "nodeType": "ElementaryTypeName", "src": "1912:7:35", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 5919, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1912:10:35", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "1900:22:35", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f2061646472657373", "id": 5921, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1924:56:35", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_37112268ceb11e15373f32f9374a1f3287d0a3e6e5a9a435ac06367e6cd0cf00", "typeString": "literal_string \"Cannot change the admin of a proxy to the zero address\"" }, "value": "Cannot change the admin of a proxy to the zero address" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_37112268ceb11e15373f32f9374a1f3287d0a3e6e5a9a435ac06367e6cd0cf00", "typeString": "literal_string \"Cannot change the admin of a proxy to the zero address\"" } ], "id": 5914, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ -18, -18 ], "referencedDeclaration": -18, "src": "1892:7:35", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 5922, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1892:89:35", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 5923, "nodeType": "ExpressionStatement", "src": "1892:89:35" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 5925, "name": "_admin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5986, "src": "2005:6:35", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", "typeString": "function () view returns (address)" } }, "id": 5926, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2005:8:35", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 5927, "name": "newAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5909, "src": "2015:8:35", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 5924, "name": "AdminChanged", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5862, "src": "1992:12:35", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address)" } }, "id": 5928, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1992:32:35", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 5929, "nodeType": "EmitStatement", "src": "1987:37:35" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 5931, "name": "newAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5909, "src": "2040:8:35", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 5930, "name": "_setAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5998, "src": "2030:9:35", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", "typeString": "function (address)" } }, "id": 5932, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2030:19:35", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 5933, "nodeType": "ExpressionStatement", "src": "2030:19:35" } ] }, "documentation": { "id": 5907, "nodeType": "StructuredDocumentation", "src": "1658:169:35", "text": " @dev Changes the admin of the proxy.\n Only the current admin can call this function.\n @param newAdmin Address to transfer proxy administration to." }, "functionSelector": "8f283970", "id": 5935, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 5912, "modifierName": { "argumentTypes": null, "id": 5911, "name": "ifAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5882, "src": "1878:7:35", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1878:7:35" } ], "name": "changeAdmin", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 5910, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5909, "mutability": "mutable", "name": "newAdmin", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5935, "src": "1851:16:35", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5908, "name": "address", "nodeType": "ElementaryTypeName", "src": "1851:7:35", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1850:18:35" }, "returnParameters": { "id": 5913, "nodeType": "ParameterList", "parameters": [], "src": "1886:0:35" }, "scope": 5999, "src": "1830:224:35", "stateMutability": "nonpayable", "virtual": false, "visibility": "external" }, { "body": { "id": 5947, "nodeType": "Block", "src": "2301:40:35", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 5944, "name": "newImplementation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5938, "