UNPKG

@openzeppelin/upgrades

Version:

JavaScript library for the OpenZeppelin smart contract platform

1,149 lines 86.7 kB
{ "fileName": "ProxyAdmin.sol", "contractName": "ProxyAdmin", "source": "pragma solidity ^0.5.0;\n\nimport \"../ownership/Ownable.sol\";\nimport \"./AdminUpgradeabilityProxy.sol\";\n\n/**\n * @title ProxyAdmin\n * @dev This contract is the admin of a proxy, and is in charge\n * of upgrading it as well as transferring it to another admin.\n */\ncontract ProxyAdmin is OpenZeppelinUpgradesOwnable {\n \n /**\n * @dev Returns the current implementation of a proxy.\n * This is needed because only the proxy admin can query it.\n * @return The address of the current implementation of the proxy.\n */\n function getProxyImplementation(AdminUpgradeabilityProxy proxy) public view returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"5c60da1b\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Returns the admin of a proxy. Only the admin can query it.\n * @return The address of the current admin of the proxy.\n */\n function getProxyAdmin(AdminUpgradeabilityProxy proxy) public view returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"f851a440\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Changes the admin of a proxy.\n * @param proxy Proxy to change admin.\n * @param newAdmin Address to transfer proxy administration to.\n */\n function changeProxyAdmin(AdminUpgradeabilityProxy proxy, address newAdmin) public onlyOwner {\n proxy.changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrades a proxy to the newest implementation of a contract.\n * @param proxy Proxy to be upgraded.\n * @param implementation the address of the Implementation.\n */\n function upgrade(AdminUpgradeabilityProxy proxy, address implementation) public onlyOwner {\n proxy.upgradeTo(implementation);\n }\n\n /**\n * @dev Upgrades a proxy to the newest implementation of a contract and forwards a function call to it.\n * This is useful to initialize the proxied contract.\n * @param proxy Proxy to be upgraded.\n * @param implementation Address of the 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 upgradeAndCall(AdminUpgradeabilityProxy proxy, address implementation, bytes memory data) payable public onlyOwner {\n proxy.upgradeToAndCall.value(msg.value)(implementation, data);\n }\n}\n", "sourcePath": "contracts/upgradeability/ProxyAdmin.sol", "sourceMap": "259:2553:40:-;;;989:10:33;980:6;;:19;;;;;;;;;;;;;;;;;;1047:6;;;;;;;;;;;1014:40;;1043:1;1014:40;;;;;;;;;;;;259:2553:40;;;;;;", "deployedSourceMap": "259:2553:40:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;518:404;;8:9:-1;5:2;;;30:1;27;20:12;5:2;518:404:40;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;518:404:40;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1812:137:33;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1812:137:33;;;:::i;:::-;;1616:131:40;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1616:131:40;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1616:131:40;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;1124:77:33;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1124:77:33;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1444:90;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1444:90:33;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;2614:196:40;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;2614:196:40;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;2614:196:40;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;2614:196:40;;;;;;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;2614:196:40;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;2614:196:40;;;;;;;;;;;;;;;:::i;:::-;;1936:132;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1936:132:40;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1936:132:40;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;2120:107:33;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2120:107:33;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;2120:107:33;;;;;;;;;;;;;;;;;;;:::i;:::-;;1067:386:40;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1067:386:40;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1067:386:40;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;518:404;603:7;768:12;782:23;817:5;809:25;;:40;;;;;;;;;;;;;;;;;;;;;;;;;;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;;767:82:40;;;;863:7;855:16;;;;;;;;895:10;884:33;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;884:33:40;;;;;;;;;;;;;;;;877:40;;;;518:404;;;:::o;1812:137:33:-;1328:9;:7;:9::i;:::-;1320:18;;;;;;;;1910:1;1873:40;;1894:6;;;;;;;;;;;1873:40;;;;;;;;;;;;1940:1;1923:6;;:19;;;;;;;;;;;;;;;;;;1812:137::o;1616:131:40:-;1328:9:33;:7;:9::i;:::-;1320:18;;;;;;;;1715:5:40;:17;;;1733:8;1715:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1715:27:40;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1715:27:40;;;;1616:131;;:::o;1124:77:33:-;1162:7;1188:6;;;;;;;;;;;1181:13;;1124:77;:::o;1444:90::-;1484:4;1521:6;;;;;;;;;;;1507:20;;:10;:20;;;1500:27;;1444:90;:::o;2614:196:40:-;1328:9:33;:7;:9::i;:::-;1320:18;;;;;;;;2744:5:40;:22;;;2773:9;2784:14;2800:4;2744:61;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;2744:61:40;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2744:61:40;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2744:61:40;;;;;2614:196;;;:::o;1936:132::-;1328:9:33;:7;:9::i;:::-;1320:18;;;;;;;;2032:5:40;:15;;;2048:14;2032:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2032:31:40;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2032:31:40;;;;1936:132;;:::o;2120:107:33:-;1328:9;:7;:9::i;:::-;1320:18;;;;;;;;2192:28;2211:8;2192:18;:28::i;:::-;2120:107;:::o;1067:386:40:-;1143:7;1299:12;1313:23;1348:5;1340:25;;:40;;;;;;;;;;;;;;;;;;;;;;;;;;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;;1298:82:40;;;;1394:7;1386:16;;;;;;;;1426:10;1415:33;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1415:33:40;;;;;;;;;;;;;;;;1408:40;;;;1067:386;;;:::o;2371:183:33:-;2464:1;2444:22;;:8;:22;;;;2436:31;;;;;;;;2511:8;2482:38;;2503:6;;;;;;;;;;;2482:38;;;;;;;;;;;;2539:8;2530:6;;:17;;;;;;;;;;;;;;;;;;2371:183;:::o", "abi": [ { "constant": true, "inputs": [ { "name": "proxy", "type": "address" } ], "name": "getProxyImplementation", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [], "name": "renounceOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "proxy", "type": "address" }, { "name": "newAdmin", "type": "address" } ], "name": "changeProxyAdmin", "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": "isOwner", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "proxy", "type": "address" }, { "name": "implementation", "type": "address" }, { "name": "data", "type": "bytes" } ], "name": "upgradeAndCall", "outputs": [], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": false, "inputs": [ { "name": "proxy", "type": "address" }, { "name": "implementation", "type": "address" } ], "name": "upgrade", "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": "proxy", "type": "address" } ], "name": "getProxyAdmin", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "previousOwner", "type": "address" }, { "indexed": true, "name": "newOwner", "type": "address" } ], "name": "OwnershipTransferred", "type": "event" } ], "ast": { "absolutePath": "contracts/upgradeability/ProxyAdmin.sol", "exportedSymbols": { "ProxyAdmin": [ 6019 ] }, "id": 6020, "nodeType": "SourceUnit", "nodes": [ { "id": 5898, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:40" }, { "absolutePath": "contracts/ownership/Ownable.sol", "file": "../ownership/Ownable.sol", "id": 5899, "nodeType": "ImportDirective", "scope": 6020, "sourceUnit": 5494, "src": "25:34:40", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "contracts/upgradeability/AdminUpgradeabilityProxy.sol", "file": "./AdminUpgradeabilityProxy.sol", "id": 5900, "nodeType": "ImportDirective", "scope": 6020, "sourceUnit": 5534, "src": "60:40:40", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 5901, "name": "OpenZeppelinUpgradesOwnable", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5493, "src": "282:27:40", "typeDescriptions": { "typeIdentifier": "t_contract$_OpenZeppelinUpgradesOwnable_$5493", "typeString": "contract OpenZeppelinUpgradesOwnable" } }, "id": 5902, "nodeType": "InheritanceSpecifier", "src": "282:27:40" } ], "contractDependencies": [ 5493 ], "contractKind": "contract", "documentation": "@title ProxyAdmin\n@dev This contract is the admin of a proxy, and is in charge\nof upgrading it as well as transferring it to another admin.", "fullyImplemented": true, "id": 6019, "linearizedBaseContracts": [ 6019, 5493 ], "name": "ProxyAdmin", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 5931, "nodeType": "Block", "src": "612:310:40", "statements": [ { "assignments": [ 5910, 5912 ], "declarations": [ { "constant": false, "id": 5910, "name": "success", "nodeType": "VariableDeclaration", "scope": 5931, "src": "768:12:40", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 5909, "name": "bool", "nodeType": "ElementaryTypeName", "src": "768:4:40", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 5912, "name": "returndata", "nodeType": "VariableDeclaration", "scope": 5931, "src": "782:23:40", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes" }, "typeName": { "id": 5911, "name": "bytes", "nodeType": "ElementaryTypeName", "src": "782:5:40", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" } }, "value": null, "visibility": "internal" } ], "id": 5919, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "5c60da1b", "id": 5917, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "835:13:40", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_96a4c6be7716f5be15d118c16bd1d464cb27f01187d0b9218993a5d488a47c29", "typeString": "literal_string (contains invalid UTF-8 sequence at position 4)" }, "value": null } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_stringliteral_96a4c6be7716f5be15d118c16bd1d464cb27f01187d0b9218993a5d488a47c29", "typeString": "literal_string (contains invalid UTF-8 sequence at position 4)" } ], "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 5914, "name": "proxy", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5904, "src": "817:5:40", "typeDescriptions": { "typeIdentifier": "t_contract$_AdminUpgradeabilityProxy_$5533", "typeString": "contract AdminUpgradeabilityProxy" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_AdminUpgradeabilityProxy_$5533", "typeString": "contract AdminUpgradeabilityProxy" } ], "id": 5913, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "809:7:40", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 5915, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "809:14:40", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "id": 5916, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "staticcall", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "809:25:40", "typeDescriptions": { "typeIdentifier": "t_function_barestaticcall_view$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$", "typeString": "function (bytes memory) view returns (bool,bytes memory)" } }, "id": 5918, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "809:40:40", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", "typeString": "tuple(bool,bytes memory)" } }, "nodeType": "VariableDeclarationStatement", "src": "767:82:40" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 5921, "name": "success", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5910, "src": "863:7:40", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 5920, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 6466, 6467 ], "referencedDeclaration": 6466, "src": "855:7:40", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 5922, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "855:16:40", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 5923, "nodeType": "ExpressionStatement", "src": "855:16:40" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 5926, "name": "returndata", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5912, "src": "895:10:40", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } }, { "argumentTypes": null, "components": [ { "argumentTypes": null, "id": 5927, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "908:7:40", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" } ], "id": 5928, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "TupleExpression", "src": "907:9:40", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" }, { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" } ], "expression": { "argumentTypes": null, "id": 5924, "name": "abi", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6450, "src": "884:3:40", "typeDescriptions": { "typeIdentifier": "t_magic_abi", "typeString": "abi" } }, "id": 5925, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "memberName": "decode", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "884:10:40", "typeDescriptions": { "typeIdentifier": "t_function_abidecode_pure$__$returns$__$", "typeString": "function () pure" } }, "id": 5929, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "884:33:40", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "functionReturnParameters": 5908, "id": 5930, "nodeType": "Return", "src": "877:40:40" } ] }, "documentation": "@dev Returns the current implementation of a proxy.\nThis is needed because only the proxy admin can query it.\n@return The address of the current implementation of the proxy.", "id": 5932, "implemented": true, "kind": "function", "modifiers": [], "name": "getProxyImplementation", "nodeType": "FunctionDefinition", "parameters": { "id": 5905, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5904, "name": "proxy", "nodeType": "VariableDeclaration", "scope": 5932, "src": "550:30:40", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_AdminUpgradeabilityProxy_$5533", "typeString": "contract AdminUpgradeabilityProxy" }, "typeName": { "contractScope": null, "id": 5903, "name": "AdminUpgradeabilityProxy", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5533, "src": "550:24:40", "typeDescriptions": { "typeIdentifier": "t_contract$_AdminUpgradeabilityProxy_$5533", "typeString": "contract AdminUpgradeabilityProxy" } }, "value": null, "visibility": "internal" } ], "src": "549:32:40" }, "returnParameters": { "id": 5908, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5907, "name": "", "nodeType": "VariableDeclaration", "scope": 5932, "src": "603:7:40", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5906, "name": "address", "nodeType": "ElementaryTypeName", "src": "603:7:40", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "602:9:40" }, "scope": 6019, "src": "518:404:40", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 5961, "nodeType": "Block", "src": "1152:301:40", "statements": [ { "assignments": [ 5940, 5942 ], "declarations": [ { "constant": false, "id": 5940, "name": "success", "nodeType": "VariableDeclaration", "scope": 5961, "src": "1299:12:40", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 5939, "name": "bool", "nodeType": "ElementaryTypeName", "src": "1299:4:40", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 5942, "name": "returndata", "nodeType": "VariableDeclaration", "scope": 5961, "src": "1313:23:40", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes" }, "typeName": { "id": 5941, "name": "bytes", "nodeType": "ElementaryTypeName", "src": "1313:5:40", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" } }, "value": null, "visibility": "internal" } ], "id": 5949, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "f851a440", "id": 5947, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1366:13:40", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_cb23cf6c353ccb16f0d92c8e6b5c5b425654e65dd07e2d295b394de4cf15afb7", "typeString": "literal_string (contains invalid UTF-8 sequence at position 0)" }, "value": null } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_stringliteral_cb23cf6c353ccb16f0d92c8e6b5c5b425654e65dd07e2d295b394de4cf15afb7", "typeString": "literal_string (contains invalid UTF-8 sequence at position 0)" } ], "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 5944, "name": "proxy", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5934, "src": "1348:5:40", "typeDescriptions": { "typeIdentifier": "t_contract$_AdminUpgradeabilityProxy_$5533", "typeString": "contract AdminUpgradeabilityProxy" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_AdminUpgradeabilityProxy_$5533", "typeString": "contract AdminUpgradeabilityProxy" } ], "id": 5943, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1340:7:40", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 5945, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1340:14:40", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "id": 5946, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "staticcall", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1340:25:40", "typeDescriptions": { "typeIdentifier": "t_function_barestaticcall_view$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$", "typeString": "function (bytes memory) view returns (bool,bytes memory)" } }, "id": 5948, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1340:40:40", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", "typeString": "tuple(bool,bytes memory)" } }, "nodeType": "VariableDeclarationStatement", "src": "1298:82:40" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 5951, "name": "success", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5940, "src": "1394:7:40", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 5950, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 6466, 6467 ], "referencedDeclaration": 6466, "src": "1386:7:40", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 5952, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1386:16:40", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 5953, "nodeType": "ExpressionStatement", "src": "1386:16:40" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 5956, "name": "returndata", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5942, "src": "1426:10:40", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } }, { "argumentTypes": null, "components": [ { "argumentTypes": null, "id": 5957, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1439:7:40", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" } ], "id": 5958, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "TupleExpression", "src": "1438:9:40", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" }, { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" } ], "expression": { "argumentTypes": null, "id": 5954, "name": "abi", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6450, "src": "1415:3:40", "typeDescriptions": { "typeIdentifier": "t_magic_abi", "typeString": "abi" } }, "id": 5955, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "memberName": "decode", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1415:10:40", "typeDescriptions": { "typeIdentifier": "t_function_abidecode_pure$__$returns$__$", "typeString": "function () pure" } }, "id": 5959, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1415:33:40", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "functionReturnParameters": 5938, "id": 5960, "nodeType": "Return", "src": "1408:40:40" } ] }, "documentation": "@dev Returns the admin of a proxy. Only the admin can query it.\n@return The address of the current admin of the proxy.", "id": 5962, "implemented": true, "kind": "function", "modifiers": [], "name": "getProxyAdmin", "nodeType": "FunctionDefinition", "parameters": { "id": 5935, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5934, "name": "proxy", "nodeType": "VariableDeclaration", "scope": 5962, "src": "1090:30:40", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_AdminUpgradeabilityProxy_$5533", "typeString": "contract AdminUpgradeabilityProxy" }, "typeName": { "contractScope": null, "id": 5933, "name": "AdminUpgradeabilityProxy", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5533, "src": "1090:24:40", "typeDescriptions": { "typeIdentifier": "t_contract$_AdminUpgradeabilityProxy_$5533", "typeString": "contract AdminUpgradeabilityProxy" } }, "value": null, "visibility": "internal" } ], "src": "1089:32:40" }, "returnParameters": { "id": 5938, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5937, "name": "", "nodeType": "VariableDeclaration", "scope": 5962, "src": "1143:7:40", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5936, "name": "address", "nodeType": "ElementaryTypeName", "src": "1143:7:40", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1142:9:40" }, "scope": 6019, "src": "1067:386:40", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 5977, "nodeType": "Block", "src": "1709:38:40", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 5974, "name": "newAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5966, "src": "1733:8:40", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "expression": { "argumentTypes": null, "id": 5971, "name": "proxy", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5964, "src": "1715:5:40", "typeDescriptions": { "typeIdentifier": "t_contract$_AdminUpgradeabilityProxy_$5533", "typeString": "contract AdminUpgradeabilityProxy" } }, "id": 5973, "isConstant": false, "isLValue": false, "isPure"