UNPKG

@openzeppelin/upgrades

Version:

JavaScript library for the OpenZeppelin smart contract platform

1,150 lines 93.8 kB
{ "fileName": "BaseAdminUpgradeabilityProxy.sol", "contractName": "BaseAdminUpgradeabilityProxy", "source": "pragma solidity ^0.5.0;\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 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 {\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": "425:3286:35:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;425:3286:35;;;;;;;", "deployedSourceMap": "425:3286:35:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;453:11:39;:9;:11::i;:::-;425:3286:35;2206:103;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2206:103:35;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;2206:103:35;;;;;;;;;;;;;;;;;;;:::i;:::-;;2826:221;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;2826:221:35;;;;;;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;2826:221:35;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;2826:221:35;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;2826:221:35;;;;;;;;;;;;:::i;:::-;;1526:96;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1526:96:35;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1798:224;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1798:224:35;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1798:224:35;;;;;;;;;;;;;;;;;;;:::i;:::-;;1384:78;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1384:78:35;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1952:90:39;1988:15;:13;:15::i;:::-;2009:28;2019:17;:15;:17::i;:::-;2009:9;:28::i;:::-;1952:90::o;2206:103:35:-;1261:8;:6;:8::i;:::-;1247:22;;:10;:22;;;1243:76;;;2275:29;2286:17;2275:10;:29::i;:::-;1243:76;;;1301:11;:9;:11::i;:::-;1243:76;2206:103;:::o;2826:221::-;1261:8;:6;:8::i;:::-;1247:22;;:10;:22;;;1243:76;;;2931:29;2942:17;2931:10;:29::i;:::-;2967:12;2984:17;:30;;3015:4;;2984:36;;;;;30:3:-1;22:6;14;1:33;57:3;49:6;45:16;35:26;;2984:36:35;;;;;;;;;;;;;;;;;;;;14:1:-1;21;16:31;;;;75:4;69:11;64:16;;144:4;140:9;133:4;115:16;111:27;107:43;104:1;100:51;94:4;87:65;169:16;166:1;159:27;225:16;222:1;215:4;212:1;208:12;193:49;7:242;;16:31;36:4;31:9;;7:242;;2966:54:35;;;3034:7;3026:16;;;;;;;;1279:1;1243:76;;;1301:11;:9;:11::i;:::-;1243:76;2826:221;;;:::o;1526:96::-;1578:7;1261:8;:6;:8::i;:::-;1247:22;;:10;:22;;;1243:76;;;1600:17;:15;:17::i;:::-;1593:24;;1243:76;;;1301:11;:9;:11::i;:::-;1243:76;1526:96;:::o;1798:224::-;1261:8;:6;:8::i;:::-;1247:22;;:10;:22;;;1243:76;;;1888:1;1868:22;;:8;:22;;;;1860:89;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1960:32;1973:8;:6;:8::i;:::-;1983;1960:32;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1998:19;2008:8;1998:9;:19::i;:::-;1243:76;;;1301:11;:9;:11::i;:::-;1243:76;1798:224;:::o;1384:78::-;1427:7;1261:8;:6;:8::i;:::-;1247:22;;:10;:22;;;1243:76;;;1449:8;:6;:8::i;:::-;1442:15;;1243:76;;;1301:11;:9;:11::i;:::-;1243:76;1384:78;:::o;3552:157::-;3614:8;:6;:8::i;:::-;3600:22;;:10;:22;;;;3592:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3683:21;:19;:21::i;:::-;3552:157::o;958:156:36:-;1008:12;1028;778:66;1043:19;;1028:34;;1099:4;1093:11;1085:19;;1077:33;;:::o;878:731:39:-;1180:12;1177:1;1174;1161:32;1370:1;1367;1353:12;1350:1;1334:14;1329:3;1316:56;1434:14;1431:1;1428;1413:36;1464:6;1524:1;1519:36;;;;1582:14;1579:1;1572:25;1519:36;1538:14;1535:1;1528:25;3092:136:35;3133:11;3152:12;962:66;3167:10;;3152:25;;3213:4;3207:11;3200:18;;3192:32;;:::o;1249:142:36:-;1311:37;1330:17;1311:18;:37::i;:::-;1368:17;1359:27;;;;;;;;;;;;1249:142;:::o;3344:133:35:-;3396:12;962:66;3411:10;;3396:25;;3458:8;3452:4;3445:22;3437:36;;:::o;1818:39:39:-;:::o;1528:305:36:-;1606:57;1645:17;1606:38;:57::i;:::-;1598:129;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1734:12;778:66;1749:19;;1734:34;;1805:17;1799:4;1792:31;1784:45;;:::o;924:616:43:-;984:4;1000:12;1499:7;1487:20;1479:28;;1532:1;1525:4;:8;1518:15;;;924:616;;;:::o", "abi": [ { "constant": false, "inputs": [ { "name": "newImplementation", "type": "address" } ], "name": "upgradeTo", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "newImplementation", "type": "address" }, { "name": "data", "type": "bytes" } ], "name": "upgradeToAndCall", "outputs": [], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": false, "inputs": [], "name": "implementation", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "newAdmin", "type": "address" } ], "name": "changeAdmin", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [], "name": "admin", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "payable": true, "stateMutability": "payable", "type": "fallback" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "previousAdmin", "type": "address" }, { "indexed": false, "name": "newAdmin", "type": "address" } ], "name": "AdminChanged", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "implementation", "type": "address" } ], "name": "Upgraded", "type": "event" } ], "ast": { "absolutePath": "contracts/upgradeability/BaseAdminUpgradeabilityProxy.sol", "exportedSymbols": { "BaseAdminUpgradeabilityProxy": [ 5689 ] }, "id": 5690, "nodeType": "SourceUnit", "nodes": [ { "id": 5535, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:35" }, { "absolutePath": "contracts/upgradeability/UpgradeabilityProxy.sol", "file": "./UpgradeabilityProxy.sol", "id": 5536, "nodeType": "ImportDirective", "scope": 5690, "sourceUnit": 6371, "src": "25:35:35", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 5537, "name": "BaseUpgradeabilityProxy", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5747, "src": "466:23:35", "typeDescriptions": { "typeIdentifier": "t_contract$_BaseUpgradeabilityProxy_$5747", "typeString": "contract BaseUpgradeabilityProxy" } }, "id": 5538, "nodeType": "InheritanceSpecifier", "src": "466:23:35" } ], "contractDependencies": [ 5747, 5896 ], "contractKind": "contract", "documentation": "@title BaseAdminUpgradeabilityProxy\n@dev This contract combines an upgradeability proxy with an authorization\nmechanism for administrative tasks.\nAll external functions in this contract must be guarded by the\n`ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity\nfeature proposal that would enable this to be done automatically.", "fullyImplemented": true, "id": 5689, "linearizedBaseContracts": [ 5689, 5747, 5896 ], "name": "BaseAdminUpgradeabilityProxy", "nodeType": "ContractDefinition", "nodes": [ { "anonymous": false, "documentation": "@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": 5544, "name": "AdminChanged", "nodeType": "EventDefinition", "parameters": { "id": 5543, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5540, "indexed": false, "name": "previousAdmin", "nodeType": "VariableDeclaration", "scope": 5544, "src": "693:21:35", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5539, "name": "address", "nodeType": "ElementaryTypeName", "src": "693:7:35", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 5542, "indexed": false, "name": "newAdmin", "nodeType": "VariableDeclaration", "scope": 5544, "src": "716:16:35", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5541, "name": "address", "nodeType": "ElementaryTypeName", "src": "716:7:35", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "692:41:35" }, "src": "674:60:35" }, { "constant": true, "id": 5547, "name": "ADMIN_SLOT", "nodeType": "VariableDeclaration", "scope": 5689, "src": "923:105:35", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 5545, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "923:7:35", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": { "argumentTypes": null, "hexValue": "307862353331323736383461353638623331373361653133623966386136303136653234336536336236653865653131373864366137313738353062356436313033", "id": 5546, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "962: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": 5561, "nodeType": "Block", "src": "1237:86:35", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 5553, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 5549, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6463, "src": "1247:3:35", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 5550, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1247:10:35", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 5551, "name": "_admin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5659, "src": "1261:6:35", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", "typeString": "function () view returns (address)" } }, "id": 5552, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1261:8:35", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1247:22:35", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": { "id": 5559, "nodeType": "Block", "src": "1293:26:35", "statements": [ { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 5556, "name": "_fallback", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5895, "src": "1301:9:35", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", "typeString": "function ()" } }, "id": 5557, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1301:11:35", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 5558, "nodeType": "ExpressionStatement", "src": "1301:11:35" } ] }, "id": 5560, "nodeType": "IfStatement", "src": "1243:76:35", "trueBody": { "id": 5555, "nodeType": "Block", "src": "1271:16:35", "statements": [ { "id": 5554, "nodeType": "PlaceholderStatement", "src": "1279:1:35" } ] } } ] }, "documentation": "@dev Modifier to check whether the `msg.sender` is the admin.\nIf it is, it will run the function. Otherwise, it will delegate the call\nto the implementation.", "id": 5562, "name": "ifAdmin", "nodeType": "ModifierDefinition", "parameters": { "id": 5548, "nodeType": "ParameterList", "parameters": [], "src": "1234:2:35" }, "src": "1218:105:35", "visibility": "internal" }, { "body": { "id": 5572, "nodeType": "Block", "src": "1436:26:35", "statements": [ { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 5569, "name": "_admin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5659, "src": "1449:6:35", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", "typeString": "function () view returns (address)" } }, "id": 5570, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1449:8:35", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "functionReturnParameters": 5568, "id": 5571, "nodeType": "Return", "src": "1442:15:35" } ] }, "documentation": "@return The address of the proxy admin.", "id": 5573, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 5565, "modifierName": { "argumentTypes": null, "id": 5564, "name": "ifAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5562, "src": "1410:7:35", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1410:7:35" } ], "name": "admin", "nodeType": "FunctionDefinition", "parameters": { "id": 5563, "nodeType": "ParameterList", "parameters": [], "src": "1398:2:35" }, "returnParameters": { "id": 5568, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5567, "name": "", "nodeType": "VariableDeclaration", "scope": 5573, "src": "1427:7:35", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5566, "name": "address", "nodeType": "ElementaryTypeName", "src": "1427:7:35", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1426:9:35" }, "scope": 5689, "src": "1384:78:35", "stateMutability": "nonpayable", "superFunction": null, "visibility": "external" }, { "body": { "id": 5583, "nodeType": "Block", "src": "1587:35:35", "statements": [ { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 5580, "name": "_implementation", "nodeType": "Identifier", "overloadedDeclarations": [ 5713 ], "referencedDeclaration": 5713, "src": "1600:15:35", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", "typeString": "function () view returns (address)" } }, "id": 5581, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1600:17:35", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "functionReturnParameters": 5579, "id": 5582, "nodeType": "Return", "src": "1593:24:35" } ] }, "documentation": "@return The address of the implementation.", "id": 5584, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 5576, "modifierName": { "argumentTypes": null, "id": 5575, "name": "ifAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5562, "src": "1561:7:35", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1561:7:35" } ], "name": "implementation", "nodeType": "FunctionDefinition", "parameters": { "id": 5574, "nodeType": "ParameterList", "parameters": [], "src": "1549:2:35" }, "returnParameters": { "id": 5579, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5578, "name": "", "nodeType": "VariableDeclaration", "scope": 5584, "src": "1578:7:35", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5577, "name": "address", "nodeType": "ElementaryTypeName", "src": "1578:7:35", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1577:9:35" }, "scope": 5689, "src": "1526:96:35", "stateMutability": "nonpayable", "superFunction": null, "visibility": "external" }, { "body": { "id": 5610, "nodeType": "Block", "src": "1854:168:35", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 5596, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 5592, "name": "newAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5586, "src": "1868:8:35", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 5594, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1888: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": 5593, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1880:7:35", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 5595, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1880:10:35", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "1868:22:35", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f2061646472657373", "id": 5597, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1892: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": 5591, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 6466, 6467 ], "referencedDeclaration": 6467, "src": "1860:7:35", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 5598, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1860:89:35", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 5599, "nodeType": "ExpressionStatement", "src": "1860:89:35" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 5601, "name": "_admin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5659, "src": "1973:6:35", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", "typeString": "function () view returns (address)" } }, "id": 5602, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1973:8:35", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 5603, "name": "newAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5586, "src": "1983:8:35", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 5600, "name": "AdminChanged", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5544, "src": "1960:12:35", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address)" } }, "id": 5604, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1960:32:35", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 5605, "nodeType": "EmitStatement", "src": "1955:37:35" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 5607, "name": "newAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5586, "src": "2008:8:35", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 5606, "name": "_setAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5670, "src": "1998:9:35", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", "typeString": "function (address)" } }, "id": 5608, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1998:19:35", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 5609, "nodeType": "ExpressionStatement", "src": "1998:19:35" } ] }, "documentation": "@dev Changes the admin of the proxy.\nOnly the current admin can call this function.\n@param newAdmin Address to transfer proxy administration to.", "id": 5611, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 5589, "modifierName": { "argumentTypes": null, "id": 5588, "name": "ifAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5562, "src": "1846:7:35", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1846:7:35" } ], "name": "changeAdmin", "nodeType": "FunctionDefinition", "parameters": { "id": 5587, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5586, "name": "newAdmin", "nodeType": "VariableDeclaration", "scope": 5611, "src": "1819:16:35", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5585, "name": "address", "nodeType": "ElementaryTypeName", "src": "1819:7:35", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1818:18:35" }, "returnParameters": { "id": 5590, "nodeType": "ParameterList", "parameters": [], "src": "1854:0:35" }, "scope": 5689, "src": "1798:224:35", "stateMutability": "nonpayable", "superFunction": null, "visibility": "external" }, { "body": { "id": 5622, "nodeType": "Block", "src": "2269:40:35", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 5619, "name": "newImplementation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5613, "src": "2286:17:35", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 5618, "name": "_upgradeTo", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5727, "src": "2275:10:35", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", "typeString": "function (address)" } }, "id": 5620, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2275:29:35", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 5621, "nodeType": "ExpressionStatement", "src": "2275:29:35" } ] }, "documentation": "@dev Upgrade the backing implementation of the proxy.\nOnly the admin can call this function.\n@param newImplementation Address of the new implementation.", "id": 5623, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 5616, "modifierName": { "argumentTypes": null, "id": 5615, "name": "ifAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5562, "src": "2261:7:35", "typeDescriptions"