UNPKG

@daostack/upgrades

Version:
1,230 lines 82.7 kB
{ "fileName": "ImplementationDirectory.sol", "contractName": "ImplementationDirectory", "source": "pragma solidity ^0.6.0;\n// SPDX-License-Identifier: MIT\n\nimport \"./ImplementationProvider.sol\";\nimport \"../ownership/Ownable.sol\";\nimport '../utils/Address.sol';\n\n/**\n * @title ImplementationDirectory\n * @dev Implementation provider that stores contract implementations in a mapping.\n */\ncontract ImplementationDirectory is ImplementationProvider, OpenZeppelinUpgradesOwnable {\n /**\n * @dev Emitted when the implementation of a contract is changed.\n * @param contractName Name of the contract.\n * @param implementation Address of the added implementation.\n */\n event ImplementationChanged(string contractName, address indexed implementation);\n\n /**\n * @dev Emitted when the implementation directory is frozen.\n */\n event Frozen();\n\n /// @dev Mapping where the addresses of the implementations are stored.\n mapping (string => address) internal implementations;\n\n /// @dev Mutability state of the directory.\n bool public frozen;\n\n /**\n * @dev Modifier that allows functions to be called only before the contract is frozen.\n */\n modifier whenNotFrozen() {\n require(!frozen, \"Cannot perform action for a frozen implementation directory\");\n _;\n }\n\n /**\n * @dev Makes the directory irreversibly immutable.\n * It can only be called once, by the owner.\n */\n function freeze() onlyOwner whenNotFrozen public {\n frozen = true;\n emit Frozen();\n }\n\n /**\n * @dev Returns the implementation address of a contract.\n * @param contractName Name of the contract.\n * @return Address of the implementation.\n */\n function getImplementation(string memory contractName) public view override returns (address) {\n return implementations[contractName];\n }\n\n /**\n * @dev Sets the address of the implementation of a contract in the directory.\n * @param contractName Name of the contract.\n * @param implementation Address of the implementation.\n */\n function setImplementation(string memory contractName, address implementation) public onlyOwner whenNotFrozen {\n require(OpenZeppelinUpgradesAddress.isContract(implementation), \"Cannot set implementation in directory with a non-contract address\");\n implementations[contractName] = implementation;\n emit ImplementationChanged(contractName, implementation);\n }\n\n /**\n * @dev Removes the address of a contract implementation from the directory.\n * @param contractName Name of the contract.\n */\n function unsetImplementation(string memory contractName) public onlyOwner whenNotFrozen {\n implementations[contractName] = address(0);\n emit ImplementationChanged(contractName, address(0));\n }\n}\n", "sourcePath": "contracts/application/ImplementationDirectory.sol", "sourceMap": "288:2316:2:-:0;;;;;;;;;;;;;978:115:33;1021:10;1012:6;;:19;;;;;;;;;;;;;;;;;;1079:6;;;;;;;;;;;1046:40;;1075:1;1046:40;;;;;;;;;;;;978:115;288:2316:2;;;;;;;;;", "deployedSourceMap": "288:2316:2:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;927:18;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1893:368;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;2403:199;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;1291:92;;;:::i;:::-;;1550:141;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1844:137:33;;;:::i;:::-;;1156:77;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1476:90;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;2152:107;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;927:18:2;;;;;;;;;;;;;:::o;1893:368::-;1360:9:33;:7;:9;;:::i;:::-;1352:18;;;;;;;;1092:6:2::1;;;;;;;;;;;1091:7;1083:79;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2017:54:::2;2056:14;2017:38;:54;;:::i;:::-;2009:133;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2180:14;2148:15;;;2164:12;2148:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:46;;;;;;;;;;;;;;;;;;2241:14;2205:51;;;2227:12;2205:51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1168:1;1380::33::1;1893:368:2::0;;;:::o;2403:199::-;1360:9:33;:7;:9;;:::i;:::-;1352:18;;;;;;;;1092:6:2::1;;;;;;;;;;;1091:7;1083:79;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2537:1:::2;2497:15;;;2513:12;2497:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:42;;;;;;;;;;;;;;;;;;2594:1;2550:47;;;2572:12;2550:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1168:1;1380::33::1;2403:199:2::0;;:::o;1291:92::-;1360:9:33;:7;:9;;:::i;:::-;1352:18;;;;;;;;1092:6:2::1;;;;;;;;;;;1091:7;1083:79;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1355:4:::2;1346:6;;:13;;;;;;;;;;;;;;;;;;1370:8;;;;;;;;;;1168:1;1380::33::1;1291:92:2::0;:::o;1550:141::-;1635:7;1657:15;;;1673:12;1657:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1650:36;;;;1550:141;;;;:::o;1844:137:33:-;1360:9;:7;:9;;:::i;:::-;1352:18;;;;;;;;1942:1:::1;1905:40;;1926:6;;;;;;;;;;;1905:40;;;;;;;;;;;;1972:1;1955:6;;:19;;;;;;;;;;;;;;;;;;1380:1;1844:137:::0;:::o;1156:77::-;1194:7;1220:6;;;;;;;;;;;1213:13;;;;1156:77;;:::o;1476:90::-;1516:4;1553:6;;;;;;;;;;;1539:20;;:10;:20;;;1532:27;;;;1476:90;;:::o;2152:107::-;1360:9;:7;:9;;:::i;:::-;1352:18;;;;;;;;2224:28:::1;2243:8;2224:18;:28;;:::i;:::-;1380:1;2152:107:::0;;:::o;956:616:43:-;1016:4;1032:12;1531:7;1519:20;1511:28;;1564:1;1557:4;:8;1550:15;;;;;956:616;;;;;:::o;2403:183:33:-;2496:1;2476:22;;:8;:22;;;;2468:31;;;;;;;;2543:8;2514:38;;2535:6;;;;;;;;;;;2514:38;;;;;;;;;;;;2571:8;2562:6;;:17;;;;;;;;;;;;;;;;;;2403:183;;:::o", "abi": [ { "anonymous": false, "inputs": [], "name": "Frozen", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "string", "name": "contractName", "type": "string" }, { "indexed": true, "internalType": "address", "name": "implementation", "type": "address" } ], "name": "ImplementationChanged", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } ], "name": "OwnershipTransferred", "type": "event" }, { "inputs": [], "name": "freeze", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "frozen", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "string", "name": "contractName", "type": "string" } ], "name": "getImplementation", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "isOwner", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "string", "name": "contractName", "type": "string" }, { "internalType": "address", "name": "implementation", "type": "address" } ], "name": "setImplementation", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "string", "name": "contractName", "type": "string" } ], "name": "unsetImplementation", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "ast": { "absolutePath": "contracts/application/ImplementationDirectory.sol", "exportedSymbols": { "ImplementationDirectory": [ 484 ] }, "id": 485, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 356, "literals": [ "solidity", "^", "0.6", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:2" }, { "absolutePath": "contracts/application/ImplementationProvider.sol", "file": "./ImplementationProvider.sol", "id": 357, "nodeType": "ImportDirective", "scope": 485, "sourceUnit": 497, "src": "57:38:2", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "contracts/ownership/Ownable.sol", "file": "../ownership/Ownable.sol", "id": 358, "nodeType": "ImportDirective", "scope": 485, "sourceUnit": 5785, "src": "96:34:2", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "contracts/utils/Address.sol", "file": "../utils/Address.sol", "id": 359, "nodeType": "ImportDirective", "scope": 485, "sourceUnit": 6775, "src": "131:30:2", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 361, "name": "ImplementationProvider", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 496, "src": "324:22:2", "typeDescriptions": { "typeIdentifier": "t_contract$_ImplementationProvider_$496", "typeString": "contract ImplementationProvider" } }, "id": 362, "nodeType": "InheritanceSpecifier", "src": "324:22:2" }, { "arguments": null, "baseName": { "contractScope": null, "id": 363, "name": "OpenZeppelinUpgradesOwnable", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5784, "src": "348:27:2", "typeDescriptions": { "typeIdentifier": "t_contract$_OpenZeppelinUpgradesOwnable_$5784", "typeString": "contract OpenZeppelinUpgradesOwnable" } }, "id": 364, "nodeType": "InheritanceSpecifier", "src": "348:27:2" } ], "contractDependencies": [ 496, 5784 ], "contractKind": "contract", "documentation": { "id": 360, "nodeType": "StructuredDocumentation", "src": "163:124:2", "text": " @title ImplementationDirectory\n @dev Implementation provider that stores contract implementations in a mapping." }, "fullyImplemented": true, "id": 484, "linearizedBaseContracts": [ 484, 5784, 496 ], "name": "ImplementationDirectory", "nodeType": "ContractDefinition", "nodes": [ { "anonymous": false, "documentation": { "id": 365, "nodeType": "StructuredDocumentation", "src": "380:188:2", "text": " @dev Emitted when the implementation of a contract is changed.\n @param contractName Name of the contract.\n @param implementation Address of the added implementation." }, "id": 371, "name": "ImplementationChanged", "nodeType": "EventDefinition", "parameters": { "id": 370, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 367, "indexed": false, "mutability": "mutable", "name": "contractName", "nodeType": "VariableDeclaration", "overrides": null, "scope": 371, "src": "599:19:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 366, "name": "string", "nodeType": "ElementaryTypeName", "src": "599:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 369, "indexed": true, "mutability": "mutable", "name": "implementation", "nodeType": "VariableDeclaration", "overrides": null, "scope": 371, "src": "620:30:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 368, "name": "address", "nodeType": "ElementaryTypeName", "src": "620:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "598:53:2" }, "src": "571:81:2" }, { "anonymous": false, "documentation": { "id": 372, "nodeType": "StructuredDocumentation", "src": "656:72:2", "text": " @dev Emitted when the implementation directory is frozen." }, "id": 374, "name": "Frozen", "nodeType": "EventDefinition", "parameters": { "id": 373, "nodeType": "ParameterList", "parameters": [], "src": "743:2:2" }, "src": "731:15:2" }, { "constant": false, "documentation": { "id": 375, "nodeType": "StructuredDocumentation", "src": "750:71:2", "text": "@dev Mapping where the addresses of the implementations are stored." }, "id": 379, "mutability": "mutable", "name": "implementations", "nodeType": "VariableDeclaration", "overrides": null, "scope": 484, "src": "824:52:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_address_$", "typeString": "mapping(string => address)" }, "typeName": { "id": 378, "keyType": { "id": 376, "name": "string", "nodeType": "ElementaryTypeName", "src": "833:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "nodeType": "Mapping", "src": "824:27:2", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_address_$", "typeString": "mapping(string => address)" }, "valueType": { "id": 377, "name": "address", "nodeType": "ElementaryTypeName", "src": "843:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } }, "value": null, "visibility": "internal" }, { "constant": false, "documentation": { "id": 380, "nodeType": "StructuredDocumentation", "src": "881:43:2", "text": "@dev Mutability state of the directory." }, "functionSelector": "054f7d9c", "id": 382, "mutability": "mutable", "name": "frozen", "nodeType": "VariableDeclaration", "overrides": null, "scope": 484, "src": "927:18:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 381, "name": "bool", "nodeType": "ElementaryTypeName", "src": "927:4:2", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "public" }, { "body": { "id": 392, "nodeType": "Block", "src": "1077:97:2", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 387, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "!", "prefix": true, "src": "1091:7:2", "subExpression": { "argumentTypes": null, "id": 386, "name": "frozen", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 382, "src": "1092:6:2", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "43616e6e6f7420706572666f726d20616374696f6e20666f7220612066726f7a656e20696d706c656d656e746174696f6e206469726563746f7279", "id": 388, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1100:61:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_d0d7da8818714c48acc93a148424f682c2ef689209261fbd5d6549d76596a141", "typeString": "literal_string \"Cannot perform action for a frozen implementation directory\"" }, "value": "Cannot perform action for a frozen implementation directory" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_d0d7da8818714c48acc93a148424f682c2ef689209261fbd5d6549d76596a141", "typeString": "literal_string \"Cannot perform action for a frozen implementation directory\"" } ], "id": 385, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ -18, -18 ], "referencedDeclaration": -18, "src": "1083:7:2", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 389, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1083:79:2", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 390, "nodeType": "ExpressionStatement", "src": "1083:79:2" }, { "id": 391, "nodeType": "PlaceholderStatement", "src": "1168:1:2" } ] }, "documentation": { "id": 383, "nodeType": "StructuredDocumentation", "src": "950:99:2", "text": " @dev Modifier that allows functions to be called only before the contract is frozen." }, "id": 393, "name": "whenNotFrozen", "nodeType": "ModifierDefinition", "overrides": null, "parameters": { "id": 384, "nodeType": "ParameterList", "parameters": [], "src": "1074:2:2" }, "src": "1052:122:2", "virtual": false, "visibility": "internal" }, { "body": { "id": 408, "nodeType": "Block", "src": "1340:43:2", "statements": [ { "expression": { "argumentTypes": null, "id": 403, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 401, "name": "frozen", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 382, "src": "1346:6:2", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "hexValue": "74727565", "id": 402, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "1355:4:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "true" }, "src": "1346:13:2", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 404, "nodeType": "ExpressionStatement", "src": "1346:13:2" }, { "eventCall": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 405, "name": "Frozen", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 374, "src": "1370:6:2", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$__$returns$__$", "typeString": "function ()" } }, "id": 406, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1370:8:2", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 407, "nodeType": "EmitStatement", "src": "1365:13:2" } ] }, "documentation": { "id": 394, "nodeType": "StructuredDocumentation", "src": "1178:110:2", "text": " @dev Makes the directory irreversibly immutable.\n It can only be called once, by the owner." }, "functionSelector": "62a5af3b", "id": 409, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 397, "modifierName": { "argumentTypes": null, "id": 396, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5711, "src": "1309:9:2", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1309:9:2" }, { "arguments": null, "id": 399, "modifierName": { "argumentTypes": null, "id": 398, "name": "whenNotFrozen", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 393, "src": "1319:13:2", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1319:13:2" } ], "name": "freeze", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 395, "nodeType": "ParameterList", "parameters": [], "src": "1306:2:2" }, "returnParameters": { "id": 400, "nodeType": "ParameterList", "parameters": [], "src": "1340:0:2" }, "scope": 484, "src": "1291:92:2", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" }, { "baseFunctions": [ 495 ], "body": { "id": 422, "nodeType": "Block", "src": "1644:47:2", "statements": [ { "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 418, "name": "implementations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 379, "src": "1657:15:2", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_address_$", "typeString": "mapping(string memory => address)" } }, "id": 420, "indexExpression": { "argumentTypes": null, "id": 419, "name": "contractName", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 412, "src": "1673:12:2", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1657:29:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "functionReturnParameters": 417, "id": 421, "nodeType": "Return", "src": "1650:36:2" } ] }, "documentation": { "id": 410, "nodeType": "StructuredDocumentation", "src": "1387:160:2", "text": " @dev Returns the implementation address of a contract.\n @param contractName Name of the contract.\n @return Address of the implementation." }, "functionSelector": "6b683896", "id": 423, "implemented": true, "kind": "function", "modifiers": [], "name": "getImplementation", "nodeType": "FunctionDefinition", "overrides": { "id": 414, "nodeType": "OverrideSpecifier", "overrides": [], "src": "1617:8:2" }, "parameters": { "id": 413, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 412, "mutability": "mutable", "name": "contractName", "nodeType": "VariableDeclaration", "overrides": null, "scope": 423, "src": "1577:26:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 411, "name": "string", "nodeType": "ElementaryTypeName", "src": "1577:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "1576:28:2" }, "returnParameters": { "id": 417, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 416, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 423, "src": "1635:7:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 415, "name": "address", "nodeType": "ElementaryTypeName", "src": "1635:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1634:9:2" }, "scope": 484, "src": "1550:141:2", "stateMutability": "view", "virtual": false, "visibility": "public" }, { "body": { "id": 454, "nodeType": "Block", "src": "2003:258:2", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 438, "name": "implementation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 428, "src": "2056:14:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "expression": { "argumentTypes": null, "id": 436, "name": "OpenZeppelinUpgradesAddress", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6774, "src": "2017:27:2", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_OpenZeppelinUpgradesAddress_$6774_$", "typeString": "type(library OpenZeppelinUpgradesAddress)" } }, "id": 437, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "isContract", "nodeType": "MemberAccess", "referencedDeclaration": 6773, "src": "2017:38:2", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_address_$returns$_t_bool_$", "typeString": "function (address) view returns (bool)" } }, "id": 439, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2017:54:2", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "43616e6e6f742073657420696d706c656d656e746174696f6e20696e206469726563746f727920776974682061206e6f6e2d636f6e74726163742061646472657373", "id": 440, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "2073:68:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_3e84e2c3ff1b12226a4666e424ac768ba59a48c1b4ea3afc112d2f6dea61af32", "typeString": "literal_string \"Cannot set implementation in directory with a non-contract address\"" }, "value": "Cannot set implementation in directory with a non-contract address" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_3e84e2c3ff1b12226a4666e424ac768ba59a48c1b4ea3afc112d2f6dea61af32", "typeString": "literal_string \"Cannot set implementation in directory with a non-contract address\"" } ], "id": 435, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ -18, -18 ], "referencedDeclaration": -18, "src": "2009:7:2", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 441, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2009:133:2", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 442, "nodeType": "ExpressionStatement", "src": "2009:133:2" }, { "expression": { "argumentTypes": null, "id": 447, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 443, "name": "implementations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 379, "src": "2148:15:2", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_address_$", "typeString": "mapping(string memory => address)" } }, "id": 445, "indexExpression": { "argumentTypes": null, "id": 444, "name": "contractName", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 426, "src": "2164:12:2", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2148:29:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 446, "name": "implementation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 428, "src": "2180:14:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "2148:46:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 448, "nodeType": "ExpressionStatement", "src": "2148:46:2" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 450, "name": "contractName", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 426, "src": "2227:12:2", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, { "argumentTypes": null, "id": 451, "name": "implementation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 428, "src": "2241:14:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 449, "name": "ImplementationChanged", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 371, "src": "2205:21:2", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_string_memory_ptr_$_t_address_$returns$__$", "typeString": "function (string memory,address)" } }, "id": 452, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2205:51:2", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 453, "nodeType": "EmitStatement", "src": "2200:56:2" } ] }, "documentation": { "id": 424, "nodeType": "StructuredDocumentation", "src": "1695:195:2", "text": " @dev Sets the address of the implementation of a contract in the directory.\n @param contractName Name of the contract.\n @param implementation Address of the implementation." }, "functionSelector": "06419fe5", "id": 455, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 431, "modifierName": { "argumentTypes": null, "id": 430, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5711, "src": "1979:9:2", "typeDescriptions": { "t