@daostack/upgrades
Version:
Proxy upgadable contracts based on openzeppelin-sdk
1,167 lines (1,166 loc) • 90.4 kB
JSON
{
"fileName": "ZosBaseAdminUpgradeabilityProxy.sol",
"contractName": "ZosBaseAdminUpgradeabilityProxy",
"source": "pragma solidity ^0.6.0;\n// SPDX-License-Identifier: MIT\n\nimport './ZosUpgradeabilityProxy.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 ZosBaseAdminUpgradeabilityProxy is ZosBaseUpgradeabilityProxy {\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 \"org.zeppelinos.proxy.admin\", and is\n * validated in the constructor.\n */\n\n bytes32 internal constant ADMIN_SLOT = 0x10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b;\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 virtual {\n // require(msg.sender != _admin(), \"Cannot call fallback function from the proxy admin\");\n // super._willFallback();\n // }\n}\n",
"sourcePath": "contracts/mocks/zos/ZosBaseAdminUpgradeabilityProxy.sol",
"sourceMap": "460:3316:28:-:0;;;;;;;;;;;;;;;;;;;;;;",
"deployedSourceMap": "460:3316:28:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;514:50:39;548:11;:9;:11;;:::i;:::-;514:50;460:3316:28;;459:51:39;494:11;:9;:11;;:::i;:::-;459:51;460:3316:28;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:28:-;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;1011:165:29:-;1070:12;1090;826:66;1105:19;;1090:34;;1161:4;1155:11;1147:19;;1139: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:28:-;3169:11;3188:12;994:66;3203:10;;3188:25;;3249:4;3243:11;3236:18;;3228:32;;;:::o;1311:142:29:-;1373:37;1392:17;1373:18;:37;;:::i;:::-;1430:17;1421:27;;;;;;;;;;;;1311:142;;:::o;3380:133:28:-;3432:12;994:66;3447:10;;3432:25;;3494:8;3488:4;3481:22;3473:36;;;:::o;1590:305:29:-;1668:57;1707:17;1668:38;:57;;:::i;:::-;1660:129;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1796:12;826:66;1811:19;;1796:34;;1867:17;1861:4;1854:31;1846: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/mocks/zos/ZosBaseAdminUpgradeabilityProxy.sol",
"exportedSymbols": {
"ZosBaseAdminUpgradeabilityProxy": [
5428
]
},
"id": 5429,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 5280,
"literals": [
"solidity",
"^",
"0.6",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:23:28"
},
{
"absolutePath": "contracts/mocks/zos/ZosUpgradeabilityProxy.sol",
"file": "./ZosUpgradeabilityProxy.sol",
"id": 5281,
"nodeType": "ImportDirective",
"scope": 5429,
"sourceUnit": 5664,
"src": "57:38:28",
"symbolAliases": [],
"unitAlias": ""
},
{
"abstract": false,
"baseContracts": [
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 5283,
"name": "ZosBaseUpgradeabilityProxy",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 5493,
"src": "504:26:28",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ZosBaseUpgradeabilityProxy_$5493",
"typeString": "contract ZosBaseUpgradeabilityProxy"
}
},
"id": 5284,
"nodeType": "InheritanceSpecifier",
"src": "504:26:28"
}
],
"contractDependencies": [
5493,
6257
],
"contractKind": "contract",
"documentation": {
"id": 5282,
"nodeType": "StructuredDocumentation",
"src": "97:362:28",
"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": 5428,
"linearizedBaseContracts": [
5428,
5493,
6257
],
"name": "ZosBaseAdminUpgradeabilityProxy",
"nodeType": "ContractDefinition",
"nodes": [
{
"anonymous": false,
"documentation": {
"id": 5285,
"nodeType": "StructuredDocumentation",
"src": "535:177:28",
"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": 5291,
"name": "AdminChanged",
"nodeType": "EventDefinition",
"parameters": {
"id": 5290,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5287,
"indexed": false,
"mutability": "mutable",
"name": "previousAdmin",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 5291,
"src": "734:21:28",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 5286,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "734:7:28",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 5289,
"indexed": false,
"mutability": "mutable",
"name": "newAdmin",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 5291,
"src": "757:16:28",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 5288,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "757:7:28",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "733:41:28"
},
"src": "715:60:28"
},
{
"constant": true,
"documentation": {
"id": 5292,
"nodeType": "StructuredDocumentation",
"src": "779:172:28",
"text": " @dev Storage slot with the admin of the contract.\n This is the keccak-256 hash of \"org.zeppelinos.proxy.admin\", and is\n validated in the constructor."
},
"id": 5295,
"mutability": "constant",
"name": "ADMIN_SLOT",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 5428,
"src": "955:105:28",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 5293,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "955:7:28",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": {
"argumentTypes": null,
"hexValue": "307831306436613534613437353463383836396436383836623566356437666266613562343532323233376561356336306431316263346537613166663933393062",
"id": 5294,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "994:66:28",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_7616251639890160809447714111544359812065171195189364993079081710756264753419_by_1",
"typeString": "int_const 7616...(68 digits omitted)...3419"
},
"value": "0x10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b"
},
"visibility": "internal"
},
{
"body": {
"id": 5310,
"nodeType": "Block",
"src": "1269:86:28",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 5302,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 5298,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "1279:3:28",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 5299,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "1279:10:28",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 5300,
"name": "_admin",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5415,
"src": "1293:6:28",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_address_$",
"typeString": "function () view returns (address)"
}
},
"id": 5301,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1293:8:28",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "1279:22:28",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"id": 5308,
"nodeType": "Block",
"src": "1325:26:28",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 5305,
"name": "_fallback",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6256,
"src": "1333:9:28",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$__$returns$__$",
"typeString": "function ()"
}
},
"id": 5306,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1333:11:28",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 5307,
"nodeType": "ExpressionStatement",
"src": "1333:11:28"
}
]
},
"id": 5309,
"nodeType": "IfStatement",
"src": "1275:76:28",
"trueBody": {
"id": 5304,
"nodeType": "Block",
"src": "1303:16:28",
"statements": [
{
"id": 5303,
"nodeType": "PlaceholderStatement",
"src": "1311:1:28"
}
]
}
}
]
},
"documentation": {
"id": 5296,
"nodeType": "StructuredDocumentation",
"src": "1065:182:28",
"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": 5311,
"name": "ifAdmin",
"nodeType": "ModifierDefinition",
"overrides": null,
"parameters": {
"id": 5297,
"nodeType": "ParameterList",
"parameters": [],
"src": "1266:2:28"
},
"src": "1250:105:28",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 5322,
"nodeType": "Block",
"src": "1468:26:28",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 5319,
"name": "_admin",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5415,
"src": "1481:6:28",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_address_$",
"typeString": "function () view returns (address)"
}
},
"id": 5320,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1481:8:28",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"functionReturnParameters": 5318,
"id": 5321,
"nodeType": "Return",
"src": "1474:15:28"
}
]
},
"documentation": {
"id": 5312,
"nodeType": "StructuredDocumentation",
"src": "1359:54:28",
"text": " @return The address of the proxy admin."
},
"functionSelector": "f851a440",
"id": 5323,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 5315,
"modifierName": {
"argumentTypes": null,
"id": 5314,
"name": "ifAdmin",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5311,
"src": "1442:7:28",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "1442:7:28"
}
],
"name": "admin",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 5313,
"nodeType": "ParameterList",
"parameters": [],
"src": "1430:2:28"
},
"returnParameters": {
"id": 5318,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5317,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 5323,
"src": "1459:7:28",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 5316,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1459:7:28",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1458:9:28"
},
"scope": 5428,
"src": "1416:78:28",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"body": {
"id": 5334,
"nodeType": "Block",
"src": "1619:35:28",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 5331,
"name": "_implementation",
"nodeType": "Identifier",
"overloadedDeclarations": [
5457
],
"referencedDeclaration": 5457,
"src": "1632:15:28",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_address_$",
"typeString": "function () view returns (address)"
}
},
"id": 5332,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1632:17:28",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"functionReturnParameters": 5330,
"id": 5333,
"nodeType": "Return",
"src": "1625:24:28"
}
]
},
"documentation": {
"id": 5324,
"nodeType": "StructuredDocumentation",
"src": "1498:57:28",
"text": " @return The address of the implementation."
},
"functionSelector": "5c60da1b",
"id": 5335,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 5327,
"modifierName": {
"argumentTypes": null,
"id": 5326,
"name": "ifAdmin",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5311,
"src": "1593:7:28",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "1593:7:28"
}
],
"name": "implementation",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 5325,
"nodeType": "ParameterList",
"parameters": [],
"src": "1581:2:28"
},
"returnParameters": {
"id": 5330,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5329,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 5335,
"src": "1610:7:28",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 5328,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1610:7:28",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1609:9:28"
},
"scope": 5428,
"src": "1558:96:28",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"body": {
"id": 5363,
"nodeType": "Block",
"src": "1886:168:28",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 5349,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 5344,
"name": "newAdmin",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5338,
"src": "1900:8:28",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "30",
"id": 5347,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1920:1:28",
"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": 5346,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1912:7:28",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 5345,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1912:7:28",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 5348,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1912:10:28",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "1900:22:28",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f2061646472657373",
"id": 5350,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1924:56:28",
"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": 5343,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "1892:7:28",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 5351,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1892:89:28",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 5352,
"nodeType": "ExpressionStatement",
"src": "1892:89:28"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 5354,
"name": "_admin",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5415,
"src": "2005:6:28",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_address_$",
"typeString": "function () view returns (address)"
}
},
"id": 5355,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2005:8:28",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 5356,
"name": "newAdmin",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5338,
"src": "2015:8:28",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 5353,
"name": "AdminChanged",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5291,
"src": "1992:12:28",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$",
"typeString": "function (address,address)"
}
},
"id": 5357,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1992:32:28",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 5358,
"nodeType": "EmitStatement",
"src": "1987:37:28"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 5360,
"name": "newAdmin",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5338,
"src": "2040:8:28",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 5359,
"name": "_setAdmin",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5427,
"src": "2030:9:28",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$",
"typeString": "function (address)"
}
},
"id": 5361,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2030:19:28",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 5362,
"nodeType": "ExpressionStatement",
"src": "2030:19:28"
}
]
},
"documentation": {
"id": 5336,
"nodeType": "StructuredDocumentation",
"src": "1658:169:28",
"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": 5364,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 5341,
"modifierName": {
"argumentTypes": null,
"id": 5340,
"name": "ifAdmin",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5311,
"src": "1878:7:28",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "1878:7:28"
}
],
"name": "changeAdmin",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 5339,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5338,
"mutability": "mutable",
"name": "newAdmin",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 5364,
"src": "1851:16:28",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 5337,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1851:7:28",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1850:18:28"
},
"returnParameters": {
"id": 5342,
"nodeType": "ParameterList",
"parameters": [],
"src": "1886:0:28"
},
"scope": 5428,
"src": "1830:224:28",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"body": {
"id": 5376,
"nodeType": "Block",
"src": "2301:40:28",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 5373,
"name": "newImplementation",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5367,