UNPKG

@daostack/upgrades

Version:
1,067 lines (1,066 loc) 285 kB
{ "fileName": "DeprecatedApp.sol", "contractName": "DeprecatedApp", "source": "pragma solidity ^0.6.0;\n// SPDX-License-Identifier: MIT\n\nimport \"../application/ImplementationProvider.sol\";\nimport \"../application/Package.sol\";\nimport { DeprecatedAdminUpgradeabilityProxy as AdminUpgradeabilityProxy } from \"../mocks/DeprecatedAdminUpgradeabilityProxy.sol\";\nimport \"../ownership/Ownable.sol\";\n\n/**\n * @title App\n * @dev Contract for upgradeable applications.\n * It handles the creation and upgrading of proxies.\n */\ncontract DeprecatedApp is OpenZeppelinUpgradesOwnable {\n /**\n * @dev Emitted when a new proxy is created.\n * @param proxy Address of the created proxy.\n */\n event ProxyCreated(address proxy);\n\n /**\n * @dev Emitted when a package dependency is changed in the application.\n * @param providerName Name of the package that changed.\n * @param package Address of the package associated to the name.\n * @param version Version of the package in use.\n */\n event PackageChanged(string providerName, address package, uint64[3] version);\n\n /**\n * @dev Tracks a package in a particular version, used for retrieving implementations\n */\n struct ProviderInfo {\n Package package;\n uint64[3] version;\n }\n\n /**\n * @dev Maps from dependency name to a tuple of package and version\n */\n mapping(string => ProviderInfo) internal providers;\n\n /**\n * @dev Constructor function.\n */\n constructor() public { }\n\n /**\n * @dev Returns the provider for a given package name, or zero if not set.\n * @param packageName Name of the package to be retrieved.\n * @return provider The provider.\n */\n function getProvider(string memory packageName) public view returns (ImplementationProvider provider) {\n ProviderInfo storage info = providers[packageName];\n if (address(info.package) == address(0)) return ImplementationProvider(0);\n return ImplementationProvider(info.package.getContract(info.version));\n }\n\n /**\n * @dev Returns information on a package given its name.\n * @param packageName Name of the package to be queried.\n * @return A tuple with the package address and pinned version given a package name, or zero if not set\n */\n function getPackage(string memory packageName) public view returns (Package, uint64[3] memory) {\n ProviderInfo storage info = providers[packageName];\n return (info.package, info.version);\n }\n\n /**\n * @dev Sets a package in a specific version as a dependency for this application.\n * Requires the version to be present in the package.\n * @param packageName Name of the package to set or overwrite.\n * @param package Address of the package to register.\n * @param version Version of the package to use in this application.\n */\n function setPackage(string memory packageName, Package package, uint64[3] memory version) public onlyOwner {\n require(package.hasVersion(version), \"The requested version must be registered in the given package\");\n providers[packageName] = ProviderInfo(package, version);\n emit PackageChanged(packageName, address(package), version);\n }\n\n /**\n * @dev Unsets a package given its name.\n * Reverts if the package is not set in the application.\n * @param packageName Name of the package to remove.\n */\n function unsetPackage(string memory packageName) public onlyOwner {\n require(address(providers[packageName].package) != address(0), \"Package to unset not found\");\n delete providers[packageName];\n emit PackageChanged(packageName, address(0), [uint64(0), uint64(0), uint64(0)]);\n }\n\n /**\n * @dev Returns the implementation address for a given contract name, provided by the `ImplementationProvider`.\n * @param packageName Name of the package where the contract is contained.\n * @param contractName Name of the contract.\n * @return Address where the contract is implemented.\n */\n function getImplementation(string memory packageName, string memory contractName) public view returns (address) {\n ImplementationProvider provider = getProvider(packageName);\n if (address(provider) == address(0)) return address(0);\n return provider.getImplementation(contractName);\n }\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 returns (address) {\n return proxy.implementation();\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 return proxy.admin();\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 Creates a new proxy for the given contract and forwards a function call to it.\n * This is useful to initialize the proxied contract.\n * @param packageName Name of the package where the contract is contained.\n * @param contractName Name of the contract.\n * @param data Data to send as msg.data to the corresponding 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 * @return Address of the new proxy.\n */\n function create(string memory packageName, string memory contractName, bytes memory data) payable public returns (AdminUpgradeabilityProxy) {\n address implementation = getImplementation(packageName, contractName);\n AdminUpgradeabilityProxy proxy = (new AdminUpgradeabilityProxy){value: msg.value}(implementation, data);\n emit ProxyCreated(address(proxy));\n return proxy;\n }\n\n /**\n * @dev Upgrades a proxy to the newest implementation of a contract.\n * @param proxy Proxy to be upgraded.\n * @param packageName Name of the package where the contract is contained.\n * @param contractName Name of the contract.\n */\n function upgrade(AdminUpgradeabilityProxy proxy, string memory packageName, string memory contractName) public onlyOwner {\n address implementation = getImplementation(packageName, contractName);\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 packageName Name of the package where the contract is contained.\n * @param contractName Name of the contract.\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, string memory packageName, string memory contractName, bytes memory data) payable public onlyOwner {\n address implementation = getImplementation(packageName, contractName);\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\n }\n}\n", "sourcePath": "contracts/mocks/DeprecatedApp.sol", "sourceMap": "434:7073:8:-:0;;;1337:24;;;;;;;;;;;978:115:33;1021:10;1012:6;;:19;;;;;;;;;;;;;;;;;;1079:6;;;;;;;;;;;1046:40;;1075:1;1046:40;;;;;;;;;;;;978:115;1337:24:8;434:7073;;;;;;;;;", "deployedSourceMap": "434:7073:8:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4013:47;;;;;3771:294;;;;;;:::o;5712:389::-;5826:24;5858:22;5883:44;5901:11;5914:12;5883:17;:44;;:::i;:::-;5858:69;;5934:30;6005:9;6016:14;6032:4;5967:70;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5934:103;;6049:28;6070:5;6049:28;;;;;;;;;;;;;;;;;;;;;;6091:5;6084:12;;;;;;5712:389;;;;;;;;:::o;1551:317::-;1620:31;1659:25;1687:9;;;1697:11;1687:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1659:50;;1752:1;1719:35;;1727:4;:12;;;;;;;;;;;;1719:35;;;1715:73;;;1786:1;1756:32;;;;;1715:73;1824:4;:12;;;;;;;;;;;;:24;;;1849:4;:12;;;;1824:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1794:69;;;;;1551:317;;;;;:::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;2654:345:8:-;1360:9:33;:7;:9;;:::i;:::-;1352:18;;;;;;;;2775:7:8::1;:18;;;2794:7;2775:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2767:101;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2899:30;;;;;;;;2912:7;2899:30;;;;;;2921:7;2899:30;;;;;2874:9;;;2884:11;2874:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:55;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;2940:54;2955:11;2976:7;2986;2940:54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1380:1:33;2654:345:8::0;;;;:::o;4823:131::-;1360:9:33;:7;:9;;:::i;:::-;1352:18;;;;;;;;4922:5:8::1;:17;;;4940:8;4922:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1380:1:33;4823:131:8::0;;;:::o;6352:238::-;1360:9:33;:7;:9;;:::i;:::-;1352:18;;;;;;;;6479:22:8::1;6504:44;6522:11;6535:12;6504:17;:44;;:::i;:::-;6479:69;;6554:5;:15;;;6570:14;6554:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1380:1:33;;6352:238:8::0;;;;:::o;2108:197::-;2176:7;2185:16;;:::i;:::-;2209:25;2237:9;;;2247:11;2237:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2209:50;;2273:4;:12;;;;;;;;;;;;2287:4;:12;;;;2265:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2108:197;;;;;:::o;1156:77:33:-;1194:7;1220:6;;;;;;;;;;;1213:13;;;;1156:77;;:::o;1476:90::-;1516:4;1553:6;;;;;;;;;;;1539:20;;:10;:20;;;1532:27;;;;1476:90;;:::o;3172:289:8:-;1360:9:33;:7;:9;;:::i;:::-;1352:18;;;;;;;;3303:1:8::1;3252:53;;3260:9;;;3270:11;3260:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:30;;;;;;;;;;;;3252:53;;;;3244:92;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3349:9;;;3359:11;3349:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3342:29;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;3382:74;3397:11;3418:1;3382:74;;;;;;;;3430:1;3382:74;;;;;;;;3441:1;3382:74;;;;;;;;3452:1;3382:74;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1380:1:33;3172:289:8::0;;:::o;7202:303::-;1360:9:33;:7;:9;;:::i;:::-;1352:18;;;;;;;;7363:22:8::1;7388:44;7406:11;7419:12;7388:17;:44;;:::i;:::-;7363:69;;7438:5;:22;;;7468:9;7479:14;7495:4;7438:62;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1380:1:33;;7202:303:8::0;;;;;:::o;2152:107:33:-;1360:9;:7;:9;;:::i;:::-;1352:18;;;;;;;;2224:28:::1;2243:8;2224:18;:28;;:::i;:::-;1380:1;2152:107:::0;;:::o;4544:116:8:-;4620:7;4642:5;:11;;;:13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4635:20;;;;4544:116;;;;:::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;-1:-1:-1:-;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", "abi": [ { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } ], "name": "OwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "string", "name": "providerName", "type": "string" }, { "indexed": false, "internalType": "address", "name": "package", "type": "address" }, { "indexed": false, "internalType": "uint64[3]", "name": "version", "type": "uint64[3]" } ], "name": "PackageChanged", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "proxy", "type": "address" } ], "name": "ProxyCreated", "type": "event" }, { "inputs": [ { "internalType": "contract DeprecatedAdminUpgradeabilityProxy", "name": "proxy", "type": "address" }, { "internalType": "address", "name": "newAdmin", "type": "address" } ], "name": "changeProxyAdmin", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "string", "name": "packageName", "type": "string" }, { "internalType": "string", "name": "contractName", "type": "string" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "create", "outputs": [ { "internalType": "contract DeprecatedAdminUpgradeabilityProxy", "name": "", "type": "address" } ], "stateMutability": "payable", "type": "function" }, { "inputs": [ { "internalType": "string", "name": "packageName", "type": "string" }, { "internalType": "string", "name": "contractName", "type": "string" } ], "name": "getImplementation", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "string", "name": "packageName", "type": "string" } ], "name": "getPackage", "outputs": [ { "internalType": "contract Package", "name": "", "type": "address" }, { "internalType": "uint64[3]", "name": "", "type": "uint64[3]" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "string", "name": "packageName", "type": "string" } ], "name": "getProvider", "outputs": [ { "internalType": "contract ImplementationProvider", "name": "provider", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "contract DeprecatedAdminUpgradeabilityProxy", "name": "proxy", "type": "address" } ], "name": "getProxyAdmin", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "contract DeprecatedAdminUpgradeabilityProxy", "name": "proxy", "type": "address" } ], "name": "getProxyImplementation", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "nonpayable", "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": "packageName", "type": "string" }, { "internalType": "contract Package", "name": "package", "type": "address" }, { "internalType": "uint64[3]", "name": "version", "type": "uint64[3]" } ], "name": "setPackage", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "string", "name": "packageName", "type": "string" } ], "name": "unsetPackage", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "contract DeprecatedAdminUpgradeabilityProxy", "name": "proxy", "type": "address" }, { "internalType": "string", "name": "packageName", "type": "string" }, { "internalType": "string", "name": "contractName", "type": "string" } ], "name": "upgrade", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "contract DeprecatedAdminUpgradeabilityProxy", "name": "proxy", "type": "address" }, { "internalType": "string", "name": "packageName", "type": "string" }, { "internalType": "string", "name": "contractName", "type": "string" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "upgradeAndCall", "outputs": [], "stateMutability": "payable", "type": "function" } ], "ast": { "absolutePath": "contracts/mocks/DeprecatedApp.sol", "exportedSymbols": { "DeprecatedApp": [ 1530 ] }, "id": 1531, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 1153, "literals": [ "solidity", "^", "0.6", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:8" }, { "absolutePath": "contracts/application/ImplementationProvider.sol", "file": "../application/ImplementationProvider.sol", "id": 1154, "nodeType": "ImportDirective", "scope": 1531, "sourceUnit": 497, "src": "57:51:8", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "contracts/application/Package.sol", "file": "../application/Package.sol", "id": 1155, "nodeType": "ImportDirective", "scope": 1531, "sourceUnit": 850, "src": "109:36:8", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "contracts/mocks/DeprecatedAdminUpgradeabilityProxy.sol", "file": "../mocks/DeprecatedAdminUpgradeabilityProxy.sol", "id": 1157, "nodeType": "ImportDirective", "scope": 1531, "sourceUnit": 1152, "src": "146:129:8", "symbolAliases": [ { "foreign": { "argumentTypes": null, "id": 1156, "name": "DeprecatedAdminUpgradeabilityProxy", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": null, "src": "155:34:8", "typeDescriptions": { "typeIdentifier": null, "typeString": null } }, "local": "AdminUpgradeabilityProxy" } ], "unitAlias": "" }, { "absolutePath": "contracts/ownership/Ownable.sol", "file": "../ownership/Ownable.sol", "id": 1158, "nodeType": "ImportDirective", "scope": 1531, "sourceUnit": 5785, "src": "276:34:8", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 1160, "name": "OpenZeppelinUpgradesOwnable", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5784, "src": "460:27:8", "typeDescriptions": { "typeIdentifier": "t_contract$_OpenZeppelinUpgradesOwnable_$5784", "typeString": "contract OpenZeppelinUpgradesOwnable" } }, "id": 1161, "nodeType": "InheritanceSpecifier", "src": "460:27:8" } ], "contractDependencies": [ 1151, 5784 ], "contractKind": "contract", "documentation": { "id": 1159, "nodeType": "StructuredDocumentation", "src": "312:121:8", "text": " @title App\n @dev Contract for upgradeable applications.\n It handles the creation and upgrading of proxies." }, "fullyImplemented": true, "id": 1530, "linearizedBaseContracts": [ 1530, 5784 ], "name": "DeprecatedApp", "nodeType": "ContractDefinition", "nodes": [ { "anonymous": false, "documentation": { "id": 1162, "nodeType": "StructuredDocumentation", "src": "492:104:8", "text": " @dev Emitted when a new proxy is created.\n @param proxy Address of the created proxy." }, "id": 1166, "name": "ProxyCreated", "nodeType": "EventDefinition", "parameters": { "id": 1165, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1164, "indexed": false, "mutability": "mutable", "name": "proxy", "nodeType": "VariableDeclaration", "overrides": null, "scope": 1166, "src": "618:13:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1163, "name": "address", "nodeType": "ElementaryTypeName", "src": "618:7:8", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "617:15:8" }, "src": "599:34:8" }, { "anonymous": false, "documentation": { "id": 1167, "nodeType": "StructuredDocumentation", "src": "637:261:8", "text": " @dev Emitted when a package dependency is changed in the application.\n @param providerName Name of the package that changed.\n @param package Address of the package associated to the name.\n @param version Version of the package in use." }, "id": 1177, "name": "PackageChanged", "nodeType": "EventDefinition", "parameters": { "id": 1176, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1169, "indexed": false, "mutability": "mutable", "name": "providerName", "nodeType": "VariableDeclaration", "overrides": null, "scope": 1177, "src": "922:19:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 1168, "name": "string", "nodeType": "ElementaryTypeName", "src": "922:6:8", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1171, "indexed": false, "mutability": "mutable", "name": "package", "nodeType": "VariableDeclaration", "overrides": null, "scope": 1177, "src": "943:15:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1170, "name": "address", "nodeType": "ElementaryTypeName", "src": "943:7:8", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1175, "indexed": false, "mutability": "mutable", "name": "version", "nodeType": "VariableDeclaration", "overrides": null, "scope": 1177, "src": "960:17:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint64_$3_memory_ptr", "typeString": "uint64[3]" }, "typeName": { "baseType": { "id": 1172, "name": "uint64", "nodeType": "ElementaryTypeName", "src": "960:6:8", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" } }, "id": 1174, "length": { "argumentTypes": null, "hexValue": "33", "id": 1173, "isConstant": false, "isLValue": false, "isPure": false, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "967:1:8", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_3_by_1", "typeString": "int_const 3" }, "value": "3" }, "nodeType": "ArrayTypeName", "src": "960:9:8", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint64_$3_storage_ptr", "typeString": "uint64[3]" } }, "value": null, "visibility": "internal" } ], "src": "921:57:8" }, "src": "901:78:8" }, { "canonicalName": "DeprecatedApp.ProviderInfo", "id": 1184, "members": [ { "constant": false, "id": 1179, "mutability": "mutable", "name": "package", "nodeType": "VariableDeclaration", "overrides": null, "scope": 1184, "src": "1109:15:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_Package_$849", "typeString": "contract Package" }, "typeName": { "contractScope": null, "id": 1178, "name": "Package", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 849, "src": "1109:7:8", "typeDescriptions": { "typeIdentifier": "t_contract$_Package_$849", "typeString": "contract Package" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1183, "mutability": "mutable", "name": "version", "nodeType": "VariableDeclaration", "overrides": null, "scope": 1184, "src": "1130:17:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint64_$3_storage_ptr", "typeString": "uint64[3]" }, "typeName": { "baseType": { "id": 1180, "name": "uint64", "nodeType": "ElementaryTypeName", "src": "1130:6:8", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" } }, "id": 1182, "length": { "argumentTypes": null, "hexValue": "33", "id": 1181, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1137:1:8", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_3_by_1", "typeString": "int_const 3" }, "value": "3" }, "nodeType": "ArrayTypeName", "src": "1130:9:8", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint64_$3_storage_ptr", "typeString": "uint64[3]" } }, "value": null, "visibility": "internal" } ], "name": "ProviderInfo", "nodeType": "StructDefinition", "scope": 1530, "src": "1083:69:8", "visibility": "public" }, { "constant": false, "documentation": { "id": 1185, "nodeType": "StructuredDocumentation", "src": "1156:79:8", "text": " @dev Maps from dependency name to a tuple of package and version" }, "id": 1189, "mutability": "mutable", "name": "providers", "nodeType": "VariableDeclaration", "overrides": null, "scope": 1530, "src": "1238:50:8", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_ProviderInfo_$1184_storage_$", "typeString": "mapping(string => struct DeprecatedApp.ProviderInfo)" }, "typeName": { "id": 1188, "keyType": { "id": 1186, "name": "string", "nodeType": "ElementaryTypeName", "src": "1246:6:8", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "nodeType": "Mapping", "src": "1238:31:8", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_ProviderInfo_$1184_storage_$", "typeString": "mapping(string => struct DeprecatedApp.ProviderInfo)" }, "valueType": { "contractScope": null, "id": 1187, "name": "ProviderInfo", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1184, "src": "1256:12:8", "typeDescriptions": { "typeIdentifier": "t_struct$_ProviderInfo_$1184_storage_ptr", "typeString": "struct DeprecatedApp.ProviderInfo" } } }, "value": null, "visibility": "internal" }, { "body": { "id": 1193, "nodeType": "Block", "src": "1358:3:8", "statements": [] }, "documentation": { "id": 1190, "nodeType": "StructuredDocumentation", "src": "1293:41:8", "text": " @dev Constructor function." }, "id": 1194, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 1191, "nodeType": "ParameterList", "parameters": [], "src": "1348:2:8" }, "returnParameters": { "id": 1192, "nodeType": "ParameterList", "parameters": [], "src": "1358:0:8" }, "scope": 1530, "src": "1337:24:8", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" }, { "body": { "id": 1232, "nodeType": "Block", "src": "1653:215:8", "statements": [ { "assignments": [ 1203 ], "declarations": [ { "constant": false, "id": 1203, "mutability": "mutable", "name": "info", "nodeType": "VariableDeclaration", "overrides": null, "scope": 1232, "src": "1659:25:8", "stateVariable": false, "storageLocation": "storage", "typeDescriptions": { "typeIdentifier": "t_struct$_ProviderInfo_$1184_storage_ptr", "typeString": "struct DeprecatedApp.ProviderInfo" }, "typeName": { "contractScope": null, "id": 1202, "name": "ProviderInfo", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1184, "src": "1659:12:8", "typeDescriptions": { "typeIdentifier": "t_struct$_ProviderInfo_$1184_storage_ptr", "typeString": "struct DeprecatedApp.ProviderInfo" } }, "value": null, "visibility": "internal" } ], "id": 1207, "initialValue": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 1204, "name": "providers", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1189, "src": "1687:9:8", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_ProviderInfo_$1184_storage_$", "typeString": "mapping(string memory => struct DeprecatedApp.ProviderInfo storage ref)" } }, "id": 1206, "indexExpression": { "argumentTypes": null, "id": 1205, "name": "packageName", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1197, "src": "1697:11:8", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1687:22:8", "typeDescriptions": { "typeIdentifier": "t_struct$_ProviderInfo_$1184_storage", "typeString": "struct DeprecatedApp.ProviderInfo storage ref" } }, "nodeType": "VariableDeclarationStatement", "src": "1659:50:8" }, { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 1217, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 1210, "name": "info", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1203, "src": "1727:4:8", "typeDescriptions": { "typeIdentifier": "t_struct$_ProviderInfo_$1184_storage_ptr", "typeString": "struct DeprecatedApp.ProviderInfo storage pointer" } }, "id": 1211, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "package", "nodeType": "MemberAccess", "referencedDeclaration": 1179, "src": "1727:12:8", "typeDescriptions": { "typeIdentifier": "t_contract$_Package_$849", "typeString": "contract Package" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Package_$849", "typeString": "contract Package" } ], "id": 1209, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1719:7:8", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 1208, "name": "address", "nodeType": "ElementaryTypeName", "src": "1719:7:8", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 1212, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1719:21:8", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 1215, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1752:1:8", "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": 1214, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false,