@daostack/upgrades
Version:
Proxy upgadable contracts based on openzeppelin-sdk
1,116 lines • 219 kB
JSON
{
"fileName": "App.sol",
"contractName": "App",
"source": "pragma solidity ^0.6.0;\n// SPDX-License-Identifier: MIT\n// SPDX-License-Identifier: MIT\n\nimport \"./ImplementationProvider.sol\";\nimport \"./Package.sol\";\nimport \"../upgradeability/AdminUpgradeabilityProxy.sol\";\nimport \"../ownership/Ownable.sol\";\n\n/**\n * @title App\n * @dev Contract for upgradeable applications.\n * It handles the creation of proxies.\n */\ncontract App 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 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 admin Address of the proxy administrator.\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, address admin, bytes memory data) payable public returns (AdminUpgradeabilityProxy) {\n address implementation = getImplementation(packageName, contractName);\n AdminUpgradeabilityProxy proxy = (new AdminUpgradeabilityProxy){value:msg.value}(implementation, admin, data);\n emit ProxyCreated(address(proxy));\n return proxy;\n }\n}\n",
"sourcePath": "contracts/application/App.sol",
"sourceMap": "353:4846:1:-:0;;;1246:24;;;;;;;;;;;978:115:33;1021:10;1012:6;;:19;;;;;;;;;;;;;;;;;;1079:6;;;;;;;;;;;1046:40;;1075:1;1046:40;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3922:47;;;;;3680:294;;;;;;:::o;1460:317::-;1529:31;1568:25;1596:9;;;1606:11;1596:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1568:50;;1661:1;1628:35;;1636:4;:12;;;;;;;;;;;;1628:35;;;1624:73;;;1695:1;1665:32;;;;;1624:73;1733:4;:12;;;;;;;;;;;;:24;;;1758:4;:12;;;;1733:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1703:69;;;;;1460: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;2563:345:1:-;1360:9:33;:7;:9;;:::i;:::-;1352:18;;;;;;;;2684:7:1::1;:18;;;2703:7;2684:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2676:101;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2808:30;;;;;;;;2821:7;2808:30;;;;;;2830:7;2808:30;;;;;2783:9;;;2793:11;2783:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:55;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;2849:54;2864:11;2885:7;2895;2849:54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1380:1:33;2563:345:1::0;;;;:::o;2017:197::-;2085:7;2094:16;;:::i;:::-;2118:25;2146:9;;;2156:11;2146:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2118:50;;2182:4;:12;;;;;;;;;;;;2196:4;:12;;;;2174:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2017: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;3081:289:1:-;1360:9:33;:7;:9;;:::i;:::-;1352:18;;;;;;;;3212:1:1::1;3161:53;;3169:9;;;3179:11;3169:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:30;;;;;;;;;;;;3161:53;;;;3153:92;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3258:9;;;3268:11;3258:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3251:29;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;3291:74;3306:11;3327:1;3291:74;;;;;;;;3339:1;3291:74;;;;;;;;3350:1;3291:74;;;;;;;;3361:1;3291:74;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1380:1:33;3081:289:1::0;;:::o;4786:411::-;4915:24;4948:22;4973:44;4991:11;5004:12;4973:17;:44;;:::i;:::-;4948:69;;5024:30;5094:9;5105:14;5121:5;5128:4;5057:76;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5024:109;;5145:28;5166:5;5145:28;;;;;;;;;;;;;;;;;;;;;;5187:5;5180:12;;;;;;4786:411;;;;;;;;;:::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;2403:183::-;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:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::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": "string",
"name": "packageName",
"type": "string"
},
{
"internalType": "string",
"name": "contractName",
"type": "string"
},
{
"internalType": "address",
"name": "admin",
"type": "address"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "create",
"outputs": [
{
"internalType": "contract AdminUpgradeabilityProxy",
"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": [],
"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"
}
],
"ast": {
"absolutePath": "contracts/application/App.sol",
"exportedSymbols": {
"App": [
354
]
},
"id": 355,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 76,
"literals": [
"solidity",
"^",
"0.6",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:23:1"
},
{
"absolutePath": "contracts/application/ImplementationProvider.sol",
"file": "./ImplementationProvider.sol",
"id": 77,
"nodeType": "ImportDirective",
"scope": 355,
"sourceUnit": 497,
"src": "89:38:1",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "contracts/application/Package.sol",
"file": "./Package.sol",
"id": 78,
"nodeType": "ImportDirective",
"scope": 355,
"sourceUnit": 850,
"src": "128:23:1",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "contracts/upgradeability/AdminUpgradeabilityProxy.sol",
"file": "../upgradeability/AdminUpgradeabilityProxy.sol",
"id": 79,
"nodeType": "ImportDirective",
"scope": 355,
"sourceUnit": 5850,
"src": "152:56:1",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "contracts/ownership/Ownable.sol",
"file": "../ownership/Ownable.sol",
"id": 80,
"nodeType": "ImportDirective",
"scope": 355,
"sourceUnit": 5785,
"src": "209:34:1",
"symbolAliases": [],
"unitAlias": ""
},
{
"abstract": false,
"baseContracts": [
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 82,
"name": "OpenZeppelinUpgradesOwnable",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 5784,
"src": "369:27:1",
"typeDescriptions": {
"typeIdentifier": "t_contract$_OpenZeppelinUpgradesOwnable_$5784",
"typeString": "contract OpenZeppelinUpgradesOwnable"
}
},
"id": 83,
"nodeType": "InheritanceSpecifier",
"src": "369:27:1"
}
],
"contractDependencies": [
5784,
5849
],
"contractKind": "contract",
"documentation": {
"id": 81,
"nodeType": "StructuredDocumentation",
"src": "245:107:1",
"text": " @title App\n @dev Contract for upgradeable applications.\n It handles the creation of proxies."
},
"fullyImplemented": true,
"id": 354,
"linearizedBaseContracts": [
354,
5784
],
"name": "App",
"nodeType": "ContractDefinition",
"nodes": [
{
"anonymous": false,
"documentation": {
"id": 84,
"nodeType": "StructuredDocumentation",
"src": "401:104:1",
"text": " @dev Emitted when a new proxy is created.\n @param proxy Address of the created proxy."
},
"id": 88,
"name": "ProxyCreated",
"nodeType": "EventDefinition",
"parameters": {
"id": 87,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 86,
"indexed": false,
"mutability": "mutable",
"name": "proxy",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 88,
"src": "527:13:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 85,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "527:7:1",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "526:15:1"
},
"src": "508:34:1"
},
{
"anonymous": false,
"documentation": {
"id": 89,
"nodeType": "StructuredDocumentation",
"src": "546:261:1",
"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": 99,
"name": "PackageChanged",
"nodeType": "EventDefinition",
"parameters": {
"id": 98,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 91,
"indexed": false,
"mutability": "mutable",
"name": "providerName",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 99,
"src": "831:19:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string"
},
"typeName": {
"id": 90,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "831:6:1",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 93,
"indexed": false,
"mutability": "mutable",
"name": "package",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 99,
"src": "852:15:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 92,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "852:7:1",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 97,
"indexed": false,
"mutability": "mutable",
"name": "version",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 99,
"src": "869:17:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint64_$3_memory_ptr",
"typeString": "uint64[3]"
},
"typeName": {
"baseType": {
"id": 94,
"name": "uint64",
"nodeType": "ElementaryTypeName",
"src": "869:6:1",
"typeDescriptions": {
"typeIdentifier": "t_uint64",
"typeString": "uint64"
}
},
"id": 96,
"length": {
"argumentTypes": null,
"hexValue": "33",
"id": 95,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "876:1:1",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_3_by_1",
"typeString": "int_const 3"
},
"value": "3"
},
"nodeType": "ArrayTypeName",
"src": "869:9:1",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint64_$3_storage_ptr",
"typeString": "uint64[3]"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "830:57:1"
},
"src": "810:78:1"
},
{
"canonicalName": "App.ProviderInfo",
"id": 106,
"members": [
{
"constant": false,
"id": 101,
"mutability": "mutable",
"name": "package",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 106,
"src": "1018:15:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Package_$849",
"typeString": "contract Package"
},
"typeName": {
"contractScope": null,
"id": 100,
"name": "Package",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 849,
"src": "1018:7:1",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Package_$849",
"typeString": "contract Package"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 105,
"mutability": "mutable",
"name": "version",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 106,
"src": "1039:17:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint64_$3_storage_ptr",
"typeString": "uint64[3]"
},
"typeName": {
"baseType": {
"id": 102,
"name": "uint64",
"nodeType": "ElementaryTypeName",
"src": "1039:6:1",
"typeDescriptions": {
"typeIdentifier": "t_uint64",
"typeString": "uint64"
}
},
"id": 104,
"length": {
"argumentTypes": null,
"hexValue": "33",
"id": 103,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1046:1:1",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_3_by_1",
"typeString": "int_const 3"
},
"value": "3"
},
"nodeType": "ArrayTypeName",
"src": "1039:9:1",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint64_$3_storage_ptr",
"typeString": "uint64[3]"
}
},
"value": null,
"visibility": "internal"
}
],
"name": "ProviderInfo",
"nodeType": "StructDefinition",
"scope": 354,
"src": "992:69:1",
"visibility": "public"
},
{
"constant": false,
"documentation": {
"id": 107,
"nodeType": "StructuredDocumentation",
"src": "1065:79:1",
"text": " @dev Maps from dependency name to a tuple of package and version"
},
"id": 111,
"mutability": "mutable",
"name": "providers",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 354,
"src": "1147:50:1",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_ProviderInfo_$106_storage_$",
"typeString": "mapping(string => struct App.ProviderInfo)"
},
"typeName": {
"id": 110,
"keyType": {
"id": 108,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "1155:6:1",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"nodeType": "Mapping",
"src": "1147:31:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_ProviderInfo_$106_storage_$",
"typeString": "mapping(string => struct App.ProviderInfo)"
},
"valueType": {
"contractScope": null,
"id": 109,
"name": "ProviderInfo",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 106,
"src": "1165:12:1",
"typeDescriptions": {
"typeIdentifier": "t_struct$_ProviderInfo_$106_storage_ptr",
"typeString": "struct App.ProviderInfo"
}
}
},
"value": null,
"visibility": "internal"
},
{
"body": {
"id": 115,
"nodeType": "Block",
"src": "1267:3:1",
"statements": []
},
"documentation": {
"id": 112,
"nodeType": "StructuredDocumentation",
"src": "1202:41:1",
"text": " @dev Constructor function."
},
"id": 116,
"implemented": true,
"kind": "constructor",
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 113,
"nodeType": "ParameterList",
"parameters": [],
"src": "1257:2:1"
},
"returnParameters": {
"id": 114,
"nodeType": "ParameterList",
"parameters": [],
"src": "1267:0:1"
},
"scope": 354,
"src": "1246:24:1",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
},
{
"body": {
"id": 154,
"nodeType": "Block",
"src": "1562:215:1",
"statements": [
{
"assignments": [
125
],
"declarations": [
{
"constant": false,
"id": 125,
"mutability": "mutable",
"name": "info",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 154,
"src": "1568:25:1",
"stateVariable": false,
"storageLocation": "storage",
"typeDescriptions": {
"typeIdentifier": "t_struct$_ProviderInfo_$106_storage_ptr",
"typeString": "struct App.ProviderInfo"
},
"typeName": {
"contractScope": null,
"id": 124,
"name": "ProviderInfo",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 106,
"src": "1568:12:1",
"typeDescriptions": {
"typeIdentifier": "t_struct$_ProviderInfo_$106_storage_ptr",
"typeString": "struct App.ProviderInfo"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 129,
"initialValue": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 126,
"name": "providers",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 111,
"src": "1596:9:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_ProviderInfo_$106_storage_$",
"typeString": "mapping(string memory => struct App.ProviderInfo storage ref)"
}
},
"id": 128,
"indexExpression": {
"argumentTypes": null,
"id": 127,
"name": "packageName",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 119,
"src": "1606:11:1",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1596:22:1",
"typeDescriptions": {
"typeIdentifier": "t_struct$_ProviderInfo_$106_storage",
"typeString": "struct App.ProviderInfo storage ref"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1568:50:1"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 139,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 132,
"name": "info",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 125,
"src": "1636:4:1",
"typeDescriptions": {
"typeIdentifier": "t_struct$_ProviderInfo_$106_storage_ptr",
"typeString": "struct App.ProviderInfo storage pointer"
}
},
"id": 133,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "package",
"nodeType": "MemberAccess",
"referencedDeclaration": 101,
"src": "1636:12:1",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Package_$849",
"typeString": "contract Package"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_Package_$849",
"typeString": "contract Package"
}
],
"id": 131,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1628:7:1",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 130,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1628:7:1",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 134,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1628:21:1",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "30",
"id": 137,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1661:1:1",
"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": 136,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1653:7:1",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 135,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1653:7:1",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 138,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1653:10:1",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "1628:35:1",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 144,
"nodeType": "IfStatement",
"src": "1624:73:1",
"trueBody": {
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "30",
"id": 141,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1695:1:1",
"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": 140,
"name": "ImplementationProvider",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 496,
"src": "1672:22:1",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ImplementationProvider_$496_$",
"typeString": "type(contract ImplementationProvider)"
}
},
"id": 142,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1672:25:1",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ImplementationProvider_$496",
"typeString": "contract ImplementationProvider"
}
},
"functionReturnParameters": 123,
"id": 143,
"nodeType": "Return",
"src": "1665:32:1"
}
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 149,
"name": "info",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 125,
"src": "1758:4:1",
"typeDescriptions": {
"typeIdentifier": "t_struct$_ProviderInfo_$106_storage_ptr",
"typeString": "struct App.ProviderInfo storage pointer"
}
},
"id": 150,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "version",
"nodeType": "MemberAccess",
"referencedDeclaration": 105,
"src": "1758:12:1",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint64_$3_storage",
"typeString": "uint64[3] storage ref"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_array$_t_uint64_$3_storage",
"typeString": "uint64[3] storage ref"
}
],
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 146,
"name": "info",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 125,
"src": "1733:4:1",
"typeDescriptions": {
"typeIdentifier": "t_struct$_ProviderInfo_$106_storage_ptr",
"typeString": "struct App.ProviderInfo storage pointer"
}
},
"id": 147,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "pa