upgrades
Version:
Proxy upgadable contracts based on openzeppelin-sdk
314 lines (313 loc) • 13.5 kB
JSON
{
"fileName": "Address.sol",
"contractName": "OpenZeppelinUpgradesAddress",
"source": "pragma solidity ^0.6.0;\n// SPDX-License-Identifier: MIT\n\n/**\n * Utility library of inline functions on addresses\n *\n * Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.1.3/contracts/utils/Address.sol\n * This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts\n * when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the\n * build/artifacts folder) as well as the vanilla Address implementation from an openzeppelin version.\n */\nlibrary OpenZeppelinUpgradesAddress {\n /**\n * Returns whether the target address is a contract\n * @dev This function will return false if invoked during the constructor of a contract,\n * as the code is not actually created until after the constructor finishes.\n * @param account address of the account to check\n * @return whether the target address is a contract\n */\n function isContract(address account) internal view returns (bool) {\n uint256 size;\n // XXX Currently there is no better way to check if there is a contract in an address\n // than to check the size of the code at that address.\n // See https://ethereum.stackexchange.com/a/14016/36603\n // for more details about how this works.\n // TODO Check this again before the Serenity release, because all addresses will be\n // contracts then.\n // solhint-disable-next-line no-inline-assembly\n assembly { size := extcodesize(account) }\n return size > 0;\n }\n}\n",
"sourcePath": "contracts/utils/Address.sol",
"sourceMap": "558:1016:43:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;",
"deployedSourceMap": "558:1016:43:-:0;;;;;;;;;;;;;;",
"abi": [],
"ast": {
"absolutePath": "contracts/utils/Address.sol",
"exportedSymbols": {
"OpenZeppelinUpgradesAddress": [
6774
]
},
"id": 6775,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 6755,
"literals": [
"solidity",
"^",
"0.6",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:23:43"
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": {
"id": 6756,
"nodeType": "StructuredDocumentation",
"src": "57:500:43",
"text": " Utility library of inline functions on addresses\n Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.1.3/contracts/utils/Address.sol\n This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts\n when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the\n build/artifacts folder) as well as the vanilla Address implementation from an openzeppelin version."
},
"fullyImplemented": true,
"id": 6774,
"linearizedBaseContracts": [
6774
],
"name": "OpenZeppelinUpgradesAddress",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 6772,
"nodeType": "Block",
"src": "1022:550:43",
"statements": [
{
"assignments": [
6765
],
"declarations": [
{
"constant": false,
"id": 6765,
"mutability": "mutable",
"name": "size",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 6772,
"src": "1032:12:43",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 6764,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1032:7:43",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 6766,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "1032:12:43"
},
{
"AST": {
"nodeType": "YulBlock",
"src": "1509:32:43",
"statements": [
{
"nodeType": "YulAssignment",
"src": "1511:28:43",
"value": {
"arguments": [
{
"name": "account",
"nodeType": "YulIdentifier",
"src": "1531:7:43"
}
],
"functionName": {
"name": "extcodesize",
"nodeType": "YulIdentifier",
"src": "1519:11:43"
},
"nodeType": "YulFunctionCall",
"src": "1519:20:43"
},
"variableNames": [
{
"name": "size",
"nodeType": "YulIdentifier",
"src": "1511:4:43"
}
]
}
]
},
"evmVersion": "constantinople",
"externalReferences": [
{
"declaration": 6759,
"isOffset": false,
"isSlot": false,
"src": "1531:7:43",
"valueSize": 1
},
{
"declaration": 6765,
"isOffset": false,
"isSlot": false,
"src": "1511:4:43",
"valueSize": 1
}
],
"id": 6767,
"nodeType": "InlineAssembly",
"src": "1500:41:43"
},
{
"expression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 6770,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 6768,
"name": "size",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6765,
"src": "1557:4:43",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 6769,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1564:1:43",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1557:8:43",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 6763,
"id": 6771,
"nodeType": "Return",
"src": "1550:15:43"
}
]
},
"documentation": {
"id": 6757,
"nodeType": "StructuredDocumentation",
"src": "600:351:43",
"text": " Returns whether the target address is a contract\n @dev This function will return false if invoked during the constructor of a contract,\n as the code is not actually created until after the constructor finishes.\n @param account address of the account to check\n @return whether the target address is a contract"
},
"id": 6773,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "isContract",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 6760,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 6759,
"mutability": "mutable",
"name": "account",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 6773,
"src": "976:15:43",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 6758,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "976:7:43",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "975:17:43"
},
"returnParameters": {
"id": 6763,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 6762,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 6773,
"src": "1016:4:43",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 6761,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "1016:4:43",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1015:6:43"
},
"scope": 6774,
"src": "956:616:43",
"stateMutability": "view",
"virtual": false,
"visibility": "internal"
}
],
"scope": 6775,
"src": "558:1016:43"
}
],
"src": "0:1575:43"
},
"bytecode": "0x605f6026600b82828239805160001a6073141515601857fe5b30600052607381538281f350fe73000000000000000000000000000000000000000030146080604052600436106023575b60006000fdfea2646970667358221220cdbe161eb88ede039c8433d00dacb2d5c20579ec73e76189c13bc5afa82c761564736f6c634300060a0033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106023575b60006000fdfea2646970667358221220cdbe161eb88ede039c8433d00dacb2d5c20579ec73e76189c13bc5afa82c761564736f6c634300060a0033",
"compiler": {
"name": "solc",
"version": "0.6.10+commit.00c0fcaf.Emscripten.clang",
"optimizer": {},
"evmVersion": "constantinople"
}
}