UNPKG

@newos/upgrades

Version:
1,093 lines (1,092 loc) 111 kB
{ "fileName": "DeprecatedAdminUpgradeabilityProxy.sol", "contractName": "DeprecatedAdminUpgradeabilityProxy", "source": "pragma solidity ^0.5.0;\n\nimport '../upgradeability/UpgradeabilityProxy.sol';\n\n/**\n * @title AdminUpgradeabilityProxy\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 DeprecatedAdminUpgradeabilityProxy is UpgradeabilityProxy {\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 bytes32 private 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 * Contract constructor.\n * It sets the `msg.sender` as the proxy administrator.\n * @param _implementation address of the initial implementation.\n * @param _data Data to send as msg.data to the implementation to initialize the proxied contract.\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 * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.\n */\n constructor(address _implementation, bytes memory _data) UpgradeabilityProxy(_implementation, _data) public payable {\n assert(ADMIN_SLOT == keccak256(\"org.zeppelinos.proxy.admin\"));\n\n _setAdmin(msg.sender);\n }\n\n /**\n * @return The address of the proxy admin.\n */\n function admin() external view 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/mocks/DeprecatedAdminUpgradeabilityProxy.sol", "sourceMap": "437:4078:7:-;;;1914:216;;;;;;;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1914:216:7;;;;;;;;;;;;;;;19:11:-1;14:3;11:20;8:2;;;44:1;41;34:12;8:2;71:11;66:3;62:21;55:28;;123:4;118:3;114:14;159:9;141:16;138:31;135:2;;;182:1;179;172:12;135:2;219:3;213:10;330:9;325:1;311:12;307:20;289:16;285:43;282:58;261:11;247:12;244:29;233:115;230:2;;;361:1;358;351:12;230:2;0:372;;1914:216:7;;;;;;1991:15;2008:5;955:1:42;910:41;;;;;;;;;;;;;;;;;;;902:50;;:54;894:63;;778:66:36;871:19:42;;:86;864:94;;;;;;964:26;983:6;964:18;;;:26;;:::i;:::-;1014:1;999:5;:12;:16;996:104;;;1026:12;1043:6;:19;;1063:5;1043:26;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;1043:26:42;;;;;;;;;;;;;;;;;;;;;;;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;;1025:44:42;;;1085:7;1077:16;;;;;;;;996:104;;795:309;;2057:39:7;;;;;;;;;;;;;;;;;;;965:66;2043:10;;:53;2036:61;;;;;;2104:21;2114:10;2104:9;;;:21;;:::i;:::-;1914:216;;437:4078;;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;4148:133:7:-;4200:12;965:66;4215:10;;4200:25;;4262:8;4256:4;4249:22;4241:36;;:::o;924:616:43:-;984:4;1000:12;1499:7;1487:20;1479:28;;1532:1;1525:4;:8;1518:15;;;924:616;;;:::o;437:4078:7:-;;;;;;;", "deployedSourceMap": "437:4078:7:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;453:11:39;:9;:11::i;:::-;437:4078:7;3010:103;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3010:103:7;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;3010:103:7;;;;;;;;;;;;;;;;;;;:::i;:::-;;3630:221;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;3630:221:7;;;;;;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;3630:221:7;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;3630:221:7;;;;;;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;3630:221:7;;;;;;;;;;;;:::i;:::-;;2330:96;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2330:96:7;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;2602:224;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2602:224:7;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;2602:224:7;;;;;;;;;;;;;;;;;;;:::i;:::-;;2191:75;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2191:75:7;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1952:90:39;1988:15;:13;:15::i;:::-;2009:28;2019:17;:15;:17::i;:::-;2009:9;:28::i;:::-;1952:90::o;3010:103:7:-;1264:8;:6;:8::i;:::-;1250:22;;:10;:22;;;1246:76;;;3079:29;3090:17;3079:10;:29::i;:::-;1246:76;;;1304:11;:9;:11::i;:::-;1246:76;3010:103;:::o;3630:221::-;1264:8;:6;:8::i;:::-;1250:22;;:10;:22;;;1246:76;;;3735:29;3746:17;3735:10;:29::i;:::-;3771:12;3788:17;:30;;3819:4;;3788:36;;;;;30:3:-1;22:6;14;1:33;57:3;49:6;45:16;35:26;;3788:36:7;;;;;;;;;;;;;;;;;;;;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;;3770:54:7;;;3838:7;3830:16;;;;;;;;1282:1;1246:76;;;1304:11;:9;:11::i;:::-;1246:76;3630:221;;;:::o;2330:96::-;2382:7;1264:8;:6;:8::i;:::-;1250:22;;:10;:22;;;1246:76;;;2404:17;:15;:17::i;:::-;2397:24;;1246:76;;;1304:11;:9;:11::i;:::-;1246:76;2330:96;:::o;2602:224::-;1264:8;:6;:8::i;:::-;1250:22;;:10;:22;;;1246:76;;;2692:1;2672:22;;:8;:22;;;;2664:89;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2764:32;2777:8;:6;:8::i;:::-;2787;2764:32;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2802:19;2812:8;2802:9;:19::i;:::-;1246:76;;;1304:11;:9;:11::i;:::-;1246:76;2602:224;:::o;2191:75::-;2231:7;2253:8;:6;:8::i;:::-;2246:15;;2191:75;:::o;4356:157::-;4418:8;:6;:8::i;:::-;4404:22;;:10;:22;;;;4396:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4487:21;:19;:21::i;:::-;4356: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;3896:136:7;3937:11;3956:12;965:66;3971:10;;3956:25;;4017:4;4011:11;4004:18;;3996:32;;:::o;1249:142:36:-;1311:37;1330:17;1311:18;:37::i;:::-;1368:17;1359:27;;;;;;;;;;;;1249:142;:::o;4148:133:7:-;4200:12;965:66;4215:10;;4200:25;;4262:8;4256:4;4249:22;4241: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": true, "inputs": [], "name": "admin", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "inputs": [ { "name": "_implementation", "type": "address" }, { "name": "_data", "type": "bytes" } ], "payable": true, "stateMutability": "payable", "type": "constructor" }, { "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/mocks/DeprecatedAdminUpgradeabilityProxy.sol", "exportedSymbols": { "DeprecatedAdminUpgradeabilityProxy": [ 1072 ] }, "id": 1073, "nodeType": "SourceUnit", "nodes": [ { "id": 895, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:7" }, { "absolutePath": "contracts/upgradeability/UpgradeabilityProxy.sol", "file": "../upgradeability/UpgradeabilityProxy.sol", "id": 896, "nodeType": "ImportDirective", "scope": 1073, "sourceUnit": 6371, "src": "25:51:7", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 897, "name": "UpgradeabilityProxy", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 6370, "src": "484:19:7", "typeDescriptions": { "typeIdentifier": "t_contract$_UpgradeabilityProxy_$6370", "typeString": "contract UpgradeabilityProxy" } }, "id": 898, "nodeType": "InheritanceSpecifier", "src": "484:19:7" } ], "contractDependencies": [ 5747, 5896, 6370 ], "contractKind": "contract", "documentation": "@title AdminUpgradeabilityProxy\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": 1072, "linearizedBaseContracts": [ 1072, 6370, 5747, 5896 ], "name": "DeprecatedAdminUpgradeabilityProxy", "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": 904, "name": "AdminChanged", "nodeType": "EventDefinition", "parameters": { "id": 903, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 900, "indexed": false, "name": "previousAdmin", "nodeType": "VariableDeclaration", "scope": 904, "src": "707:21:7", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 899, "name": "address", "nodeType": "ElementaryTypeName", "src": "707:7:7", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 902, "indexed": false, "name": "newAdmin", "nodeType": "VariableDeclaration", "scope": 904, "src": "730:16:7", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 901, "name": "address", "nodeType": "ElementaryTypeName", "src": "730:7:7", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "706:41:7" }, "src": "688:60:7" }, { "constant": true, "id": 907, "name": "ADMIN_SLOT", "nodeType": "VariableDeclaration", "scope": 1072, "src": "927:104:7", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 905, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "927:7:7", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": { "argumentTypes": null, "hexValue": "307831306436613534613437353463383836396436383836623566356437666266613562343532323233376561356336306431316263346537613166663933393062", "id": 906, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "965:66:7", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_7616251639890160809447714111544359812065171195189364993079081710756264753419_by_1", "typeString": "int_const 7616...(68 digits omitted)...3419" }, "value": "0x10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b" }, "visibility": "private" }, { "body": { "id": 921, "nodeType": "Block", "src": "1240:86:7", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 913, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 909, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6463, "src": "1250:3:7", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 910, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1250:10:7", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 911, "name": "_admin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1042, "src": "1264:6:7", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", "typeString": "function () view returns (address)" } }, "id": 912, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1264:8:7", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1250:22:7", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": { "id": 919, "nodeType": "Block", "src": "1296:26:7", "statements": [ { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 916, "name": "_fallback", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5895, "src": "1304:9:7", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", "typeString": "function ()" } }, "id": 917, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1304:11:7", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 918, "nodeType": "ExpressionStatement", "src": "1304:11:7" } ] }, "id": 920, "nodeType": "IfStatement", "src": "1246:76:7", "trueBody": { "id": 915, "nodeType": "Block", "src": "1274:16:7", "statements": [ { "id": 914, "nodeType": "PlaceholderStatement", "src": "1282:1:7" } ] } } ] }, "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": 922, "name": "ifAdmin", "nodeType": "ModifierDefinition", "parameters": { "id": 908, "nodeType": "ParameterList", "parameters": [], "src": "1237:2:7" }, "src": "1221:105:7", "visibility": "internal" }, { "body": { "id": 946, "nodeType": "Block", "src": "2030:100:7", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "id": 938, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 934, "name": "ADMIN_SLOT", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 907, "src": "2043:10:7", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "6f72672e7a657070656c696e6f732e70726f78792e61646d696e", "id": 936, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "2067:28:7", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b", "typeString": "literal_string \"org.zeppelinos.proxy.admin\"" }, "value": "org.zeppelinos.proxy.admin" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_stringliteral_10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b", "typeString": "literal_string \"org.zeppelinos.proxy.admin\"" } ], "id": 935, "name": "keccak256", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6457, "src": "2057:9:7", "typeDescriptions": { "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", "typeString": "function (bytes memory) pure returns (bytes32)" } }, "id": 937, "isConstant": false, "isLValue": false, "isPure": true, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2057:39:7", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "src": "2043:53:7", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 933, "name": "assert", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6452, "src": "2036:6:7", "typeDescriptions": { "typeIdentifier": "t_function_assert_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 939, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2036:61:7", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 940, "nodeType": "ExpressionStatement", "src": "2036:61:7" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 942, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6463, "src": "2114:3:7", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 943, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2114:10:7", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address_payable", "typeString": "address payable" } ], "id": 941, "name": "_setAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1053, "src": "2104:9:7", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", "typeString": "function (address)" } }, "id": 944, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2104:21:7", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 945, "nodeType": "ExpressionStatement", "src": "2104:21:7" } ] }, "documentation": "Contract constructor.\nIt sets the `msg.sender` as the proxy administrator.\n@param _implementation address of the initial implementation.\n@param _data Data to send as msg.data to the implementation to initialize the proxied contract.\nIt should include the signature and the parameters of the function to be called, as described in\nhttps://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.\nThis parameter is optional, if no data is given the initialization call to proxied contract will be skipped.", "id": 947, "implemented": true, "kind": "constructor", "modifiers": [ { "arguments": [ { "argumentTypes": null, "id": 929, "name": "_implementation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 924, "src": "1991:15:7", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 930, "name": "_data", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 926, "src": "2008:5:7", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } } ], "id": 931, "modifierName": { "argumentTypes": null, "id": 928, "name": "UpgradeabilityProxy", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6370, "src": "1971:19:7", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_UpgradeabilityProxy_$6370_$", "typeString": "type(contract UpgradeabilityProxy)" } }, "nodeType": "ModifierInvocation", "src": "1971:43:7" } ], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 927, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 924, "name": "_implementation", "nodeType": "VariableDeclaration", "scope": 947, "src": "1926:23:7", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 923, "name": "address", "nodeType": "ElementaryTypeName", "src": "1926:7:7", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 926, "name": "_data", "nodeType": "VariableDeclaration", "scope": 947, "src": "1951:18:7", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes" }, "typeName": { "id": 925, "name": "bytes", "nodeType": "ElementaryTypeName", "src": "1951:5:7", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" } }, "value": null, "visibility": "internal" } ], "src": "1925:45:7" }, "returnParameters": { "id": 932, "nodeType": "ParameterList", "parameters": [], "src": "2030:0:7" }, "scope": 1072, "src": "1914:216:7", "stateMutability": "payable", "superFunction": null, "visibility": "public" }, { "body": { "id": 955, "nodeType": "Block", "src": "2240:26:7", "statements": [ { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 952, "name": "_admin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1042, "src": "2253:6:7", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", "typeString": "function () view returns (address)" } }, "id": 953, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2253:8:7", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "functionReturnParameters": 951, "id": 954, "nodeType": "Return", "src": "2246:15:7" } ] }, "documentation": "@return The address of the proxy admin.", "id": 956, "implemented": true, "kind": "function", "modifiers": [], "name": "admin", "nodeType": "FunctionDefinition", "parameters": { "id": 948, "nodeType": "ParameterList", "parameters": [], "src": "2205:2:7" }, "returnParameters": { "id": 951, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 950, "name": "", "nodeType": "VariableDeclaration", "scope": 956, "src": "2231:7:7", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 949, "name": "address", "nodeType": "ElementaryTypeName", "src": "2231:7:7", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "2230:9:7" }, "scope": 1072, "src": "2191:75:7", "stateMutability": "view", "superFunction": null, "visibility": "external" }, { "body": { "id": 966, "nodeType": "Block", "src": "2391:35:7", "statements": [ { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 963, "name": "_implementation", "nodeType": "Identifier", "overloadedDeclarations": [ 5713 ], "referencedDeclaration": 5713, "src": "2404:15:7", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", "typeString": "function () view returns (address)" } }, "id": 964, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2404:17:7", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "functionReturnParameters": 962, "id": 965, "nodeType": "Return", "src": "2397:24:7" } ] }, "documentation": "@return The address of the implementation.", "id": 967, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 959, "modifierName": { "argumentTypes": null, "id": 958, "name": "ifAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 922, "src": "2365:7:7", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "2365:7:7" } ], "name": "implementation", "nodeType": "FunctionDefinition", "parameters": { "id": 957, "nodeType": "ParameterList", "parameters": [], "src": "2353:2:7" }, "returnParameters": { "id": 962, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 961, "name": "", "nodeType": "VariableDeclaration", "scope": 967, "src": "2382:7:7", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 960, "name": "address", "nodeType": "ElementaryTypeName", "src": "2382:7:7", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "2381:9:7" }, "scope": 1072, "src": "2330:96:7", "stateMutability": "nonpayable", "superFunction": null, "visibility": "external" }, { "body": { "id": 993, "nodeType": "Block", "src": "2658:168:7", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 979, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 975, "name": "newAdmin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 969, "src": "2672:8:7", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 977, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2692:1:7", "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": 976, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false,