UNPKG

@gnosis.pm/hg-contracts

Version:

Collection of smart contracts for the Gnosis prediction market platform

1,021 lines (1,020 loc) 504 kB
{ "contractName": "ERC1820ImplementerInterface", "abi": [ { "constant": true, "inputs": [ { "name": "interfaceHash", "type": "bytes32" }, { "name": "addr", "type": "address" } ], "name": "canImplementInterfaceForAddress", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "bytecode": "0x", "deployedBytecode": "0x", "sourceMap": "", "deployedSourceMap": "", "source": "/* ERC1820 Pseudo-introspection Registry Contract\n * This standard defines a universal registry smart contract where any address (contract or regular account) can\n * register which interface it supports and which smart contract is responsible for its implementation.\n *\n * Written in 2019 by Jordi Baylina and Jacques Dafflon\n *\n * To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to\n * this software to the public domain worldwide. This software is distributed without any warranty.\n *\n * You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see\n * <http://creativecommons.org/publicdomain/zero/1.0/>.\n *\n * ███████╗██████╗ ██████╗ ██╗ █████╗ ██████╗ ██████╗\n * ██╔════╝██╔══██╗██╔════╝███║██╔══██╗╚════██╗██╔═████╗\n * █████╗ ██████╔╝██║ ╚██║╚█████╔╝ █████╔╝██║██╔██║\n * ██╔══╝ ██╔══██╗██║ ██║██╔══██╗██╔═══╝ ████╔╝██║\n * ███████╗██║ ██║╚██████╗ ██║╚█████╔╝███████╗╚██████╔╝\n * ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚════╝ ╚══════╝ ╚═════╝\n *\n * ██████╗ ███████╗ ██████╗ ██╗███████╗████████╗██████╗ ██╗ ██╗\n * ██╔══██╗██╔════╝██╔════╝ ██║██╔════╝╚══██╔══╝██╔══██╗╚██╗ ██╔╝\n * ██████╔╝█████╗ ██║ ███╗██║███████╗ ██║ ██████╔╝ ╚████╔╝\n * ██╔══██╗██╔══╝ ██║ ██║██║╚════██║ ██║ ██╔══██╗ ╚██╔╝\n * ██║ ██║███████╗╚██████╔╝██║███████║ ██║ ██║ ██║ ██║\n * ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝\n *\n */\npragma solidity ^0.5.0;\n// IV is value needed to have a vanity address starting with '0x1820'.\n// IV: 53759\n\n/// @dev The interface a contract MUST implement if it is the implementer of\n/// some (other) interface for any address other than itself.\ninterface ERC1820ImplementerInterface {\n /// @notice Indicates whether the contract implements the interface 'interfaceHash' for the address 'addr' or not.\n /// @param interfaceHash keccak256 hash of the name of the interface\n /// @param addr Address for which the contract will implement the interface\n /// @return ERC1820_ACCEPT_MAGIC only if the contract implements 'interfaceHash' for the address 'addr'.\n function canImplementInterfaceForAddress(bytes32 interfaceHash, address addr) external view returns(bytes32);\n}\n\n\n/// @title ERC1820 Pseudo-introspection Registry Contract\n/// @author Jordi Baylina and Jacques Dafflon\n/// @notice This contract is the official implementation of the ERC1820 Registry.\n/// @notice For more details, see https://eips.ethereum.org/EIPS/eip-1820\ncontract ERC1820Registry {\n /// @notice ERC165 Invalid ID.\n bytes4 constant internal INVALID_ID = 0xffffffff;\n /// @notice Method ID for the ERC165 supportsInterface method (= `bytes4(keccak256('supportsInterface(bytes4)'))`).\n bytes4 constant internal ERC165ID = 0x01ffc9a7;\n /// @notice Magic value which is returned if a contract implements an interface on behalf of some other address.\n bytes32 constant internal ERC1820_ACCEPT_MAGIC = keccak256(abi.encodePacked(\"ERC1820_ACCEPT_MAGIC\"));\n\n /// @notice mapping from addresses and interface hashes to their implementers.\n mapping(address => mapping(bytes32 => address)) internal interfaces;\n /// @notice mapping from addresses to their manager.\n mapping(address => address) internal managers;\n /// @notice flag for each address and erc165 interface to indicate if it is cached.\n mapping(address => mapping(bytes4 => bool)) internal erc165Cached;\n\n /// @notice Indicates a contract is the 'implementer' of 'interfaceHash' for 'addr'.\n event InterfaceImplementerSet(address indexed addr, bytes32 indexed interfaceHash, address indexed implementer);\n /// @notice Indicates 'newManager' is the address of the new manager for 'addr'.\n event ManagerChanged(address indexed addr, address indexed newManager);\n\n /// @notice Query if an address implements an interface and through which contract.\n /// @param _addr Address being queried for the implementer of an interface.\n /// (If '_addr' is the zero address then 'msg.sender' is assumed.)\n /// @param _interfaceHash Keccak256 hash of the name of the interface as a string.\n /// E.g., 'web3.utils.keccak256(\"ERC777TokensRecipient\")' for the 'ERC777TokensRecipient' interface.\n /// @return The address of the contract which implements the interface '_interfaceHash' for '_addr'\n /// or '0' if '_addr' did not register an implementer for this interface.\n function getInterfaceImplementer(address _addr, bytes32 _interfaceHash) external view returns (address) {\n address addr = _addr == address(0) ? msg.sender : _addr;\n if (isERC165Interface(_interfaceHash)) {\n bytes4 erc165InterfaceHash = bytes4(_interfaceHash);\n return implementsERC165Interface(addr, erc165InterfaceHash) ? addr : address(0);\n }\n return interfaces[addr][_interfaceHash];\n }\n\n /// @notice Sets the contract which implements a specific interface for an address.\n /// Only the manager defined for that address can set it.\n /// (Each address is the manager for itself until it sets a new manager.)\n /// @param _addr Address for which to set the interface.\n /// (If '_addr' is the zero address then 'msg.sender' is assumed.)\n /// @param _interfaceHash Keccak256 hash of the name of the interface as a string.\n /// E.g., 'web3.utils.keccak256(\"ERC777TokensRecipient\")' for the 'ERC777TokensRecipient' interface.\n /// @param _implementer Contract address implementing '_interfaceHash' for '_addr'.\n function setInterfaceImplementer(address _addr, bytes32 _interfaceHash, address _implementer) external {\n address addr = _addr == address(0) ? msg.sender : _addr;\n require(getManager(addr) == msg.sender, \"Not the manager\");\n\n require(!isERC165Interface(_interfaceHash), \"Must not be an ERC165 hash\");\n if (_implementer != address(0) && _implementer != msg.sender) {\n require(\n ERC1820ImplementerInterface(_implementer)\n .canImplementInterfaceForAddress(_interfaceHash, addr) == ERC1820_ACCEPT_MAGIC,\n \"Does not implement the interface\"\n );\n }\n interfaces[addr][_interfaceHash] = _implementer;\n emit InterfaceImplementerSet(addr, _interfaceHash, _implementer);\n }\n\n /// @notice Sets '_newManager' as manager for '_addr'.\n /// The new manager will be able to call 'setInterfaceImplementer' for '_addr'.\n /// @param _addr Address for which to set the new manager.\n /// @param _newManager Address of the new manager for 'addr'. (Pass '0x0' to reset the manager to '_addr'.)\n function setManager(address _addr, address _newManager) external {\n require(getManager(_addr) == msg.sender, \"Not the manager\");\n managers[_addr] = _newManager == _addr ? address(0) : _newManager;\n emit ManagerChanged(_addr, _newManager);\n }\n\n /// @notice Get the manager of an address.\n /// @param _addr Address for which to return the manager.\n /// @return Address of the manager for a given address.\n function getManager(address _addr) public view returns(address) {\n // By default the manager of an address is the same address\n if (managers[_addr] == address(0)) {\n return _addr;\n } else {\n return managers[_addr];\n }\n }\n\n /// @notice Compute the keccak256 hash of an interface given its name.\n /// @param _interfaceName Name of the interface.\n /// @return The keccak256 hash of an interface name.\n function interfaceHash(string calldata _interfaceName) external pure returns(bytes32) {\n return keccak256(abi.encodePacked(_interfaceName));\n }\n\n /* --- ERC165 Related Functions --- */\n /* --- Developed in collaboration with William Entriken. --- */\n\n /// @notice Updates the cache with whether the contract implements an ERC165 interface or not.\n /// @param _contract Address of the contract for which to update the cache.\n /// @param _interfaceId ERC165 interface for which to update the cache.\n function updateERC165Cache(address _contract, bytes4 _interfaceId) external {\n interfaces[_contract][_interfaceId] = implementsERC165InterfaceNoCache(\n _contract, _interfaceId) ? _contract : address(0);\n erc165Cached[_contract][_interfaceId] = true;\n }\n\n /// @notice Checks whether a contract implements an ERC165 interface or not.\n // If the result is not cached a direct lookup on the contract address is performed.\n // If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling\n // 'updateERC165Cache' with the contract address.\n /// @param _contract Address of the contract to check.\n /// @param _interfaceId ERC165 interface to check.\n /// @return True if '_contract' implements '_interfaceId', false otherwise.\n function implementsERC165Interface(address _contract, bytes4 _interfaceId) public view returns (bool) {\n if (!erc165Cached[_contract][_interfaceId]) {\n return implementsERC165InterfaceNoCache(_contract, _interfaceId);\n }\n return interfaces[_contract][_interfaceId] == _contract;\n }\n\n /// @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.\n /// @param _contract Address of the contract to check.\n /// @param _interfaceId ERC165 interface to check.\n /// @return True if '_contract' implements '_interfaceId', false otherwise.\n function implementsERC165InterfaceNoCache(address _contract, bytes4 _interfaceId) public view returns (bool) {\n uint256 success;\n uint256 result;\n\n (success, result) = noThrowCall(_contract, ERC165ID);\n if (success == 0 || result == 0) {\n return false;\n }\n\n (success, result) = noThrowCall(_contract, INVALID_ID);\n if (success == 0 || result != 0) {\n return false;\n }\n\n (success, result) = noThrowCall(_contract, _interfaceId);\n if (success == 1 && result == 1) {\n return true;\n }\n return false;\n }\n\n /// @notice Checks whether the hash is a ERC165 interface (ending with 28 zeroes) or not.\n /// @param _interfaceHash The hash to check.\n /// @return True if '_interfaceHash' is an ERC165 interface (ending with 28 zeroes), false otherwise.\n function isERC165Interface(bytes32 _interfaceHash) internal pure returns (bool) {\n return _interfaceHash & 0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF == 0;\n }\n\n /// @dev Make a call on a contract without throwing if the function does not exist.\n function noThrowCall(address _contract, bytes4 _interfaceId)\n internal view returns (uint256 success, uint256 result)\n {\n bytes4 erc165ID = ERC165ID;\n\n assembly {\n let x := mload(0x40) // Find empty storage location using \"free memory pointer\"\n mstore(x, erc165ID) // Place signature at beginning of empty storage\n mstore(add(x, 0x04), _interfaceId) // Place first argument directly next to signature\n\n success := staticcall(\n 30000, // 30k gas\n _contract, // To addr\n x, // Inputs are stored at location x\n 0x24, // Inputs are 36 (4 + 32) bytes long\n x, // Store output over input (saves space)\n 0x20 // Outputs are 32 bytes long\n )\n\n result := mload(x) // Load the result\n }\n }\n}", "sourcePath": "/home/alan/src/github.com/gnosis/hg-contracts/contracts/ERC1820Registry.sol", "ast": { "absolutePath": "/home/alan/src/github.com/gnosis/hg-contracts/contracts/ERC1820Registry.sol", "exportedSymbols": { "ERC1820ImplementerInterface": [ 790 ], "ERC1820Registry": [ 1210 ] }, "id": 1211, "nodeType": "SourceUnit", "nodes": [ { "id": 780, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "2659:23:4" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "interface", "documentation": "@dev The interface a contract MUST implement if it is the implementer of\n some (other) interface for any address other than itself.", "fullyImplemented": false, "id": 790, "linearizedBaseContracts": [ 790 ], "name": "ERC1820ImplementerInterface", "nodeType": "ContractDefinition", "nodes": [ { "body": null, "documentation": "@notice Indicates whether the contract implements the interface 'interfaceHash' for the address 'addr' or not.\n @param interfaceHash keccak256 hash of the name of the interface\n @param addr Address for which the contract will implement the interface\n @return ERC1820_ACCEPT_MAGIC only if the contract implements 'interfaceHash' for the address 'addr'.", "id": 789, "implemented": false, "kind": "function", "modifiers": [], "name": "canImplementInterfaceForAddress", "nodeType": "FunctionDefinition", "parameters": { "id": 785, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 782, "name": "interfaceHash", "nodeType": "VariableDeclaration", "scope": 789, "src": "3373:21:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 781, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "3373:7:4", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 784, "name": "addr", "nodeType": "VariableDeclaration", "scope": 789, "src": "3396:12:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 783, "name": "address", "nodeType": "ElementaryTypeName", "src": "3396:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "3372:37:4" }, "returnParameters": { "id": 788, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 787, "name": "", "nodeType": "VariableDeclaration", "scope": 789, "src": "3432:7:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 786, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "3432:7:4", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" } ], "src": "3431:9:4" }, "scope": 790, "src": "3332:109:4", "stateMutability": "view", "superFunction": null, "visibility": "external" } ], "scope": 1211, "src": "2907:536:4" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": "@title ERC1820 Pseudo-introspection Registry Contract\n @author Jordi Baylina and Jacques Dafflon\n @notice This contract is the official implementation of the ERC1820 Registry.\n @notice For more details, see https://eips.ethereum.org/EIPS/eip-1820", "fullyImplemented": true, "id": 1210, "linearizedBaseContracts": [ 1210 ], "name": "ERC1820Registry", "nodeType": "ContractDefinition", "nodes": [ { "constant": true, "id": 793, "name": "INVALID_ID", "nodeType": "VariableDeclaration", "scope": 1210, "src": "3772:48:4", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" }, "typeName": { "id": 791, "name": "bytes4", "nodeType": "ElementaryTypeName", "src": "3772:6:4", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" } }, "value": { "argumentTypes": null, "hexValue": "30786666666666666666", "id": 792, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "3810:10:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_4294967295_by_1", "typeString": "int_const 4294967295" }, "value": "0xffffffff" }, "visibility": "internal" }, { "constant": true, "id": 796, "name": "ERC165ID", "nodeType": "VariableDeclaration", "scope": 1210, "src": "3946:46:4", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" }, "typeName": { "id": 794, "name": "bytes4", "nodeType": "ElementaryTypeName", "src": "3946:6:4", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" } }, "value": { "argumentTypes": null, "hexValue": "30783031666663396137", "id": 795, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "3982:10:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_33540519_by_1", "typeString": "int_const 33540519" }, "value": "0x01ffc9a7" }, "visibility": "internal" }, { "constant": true, "id": 804, "name": "ERC1820_ACCEPT_MAGIC", "nodeType": "VariableDeclaration", "scope": 1210, "src": "4115:100:4", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 797, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "4115:7:4", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "455243313832305f4143434550545f4d41474943", "id": 801, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "4191:22:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_a2ef4600d742022d532d4747cb3547474667d6f13804902513b2ec01c848f4b4", "typeString": "literal_string \"ERC1820_ACCEPT_MAGIC\"" }, "value": "ERC1820_ACCEPT_MAGIC" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_stringliteral_a2ef4600d742022d532d4747cb3547474667d6f13804902513b2ec01c848f4b4", "typeString": "literal_string \"ERC1820_ACCEPT_MAGIC\"" } ], "expression": { "argumentTypes": null, "id": 799, "name": "abi", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2782, "src": "4174:3:4", "typeDescriptions": { "typeIdentifier": "t_magic_abi", "typeString": "abi" } }, "id": 800, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "memberName": "encodePacked", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "4174:16:4", "typeDescriptions": { "typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$", "typeString": "function () pure returns (bytes memory)" } }, "id": 802, "isConstant": false, "isLValue": false, "isPure": true, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "4174:40:4", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } ], "id": 798, "name": "keccak256", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2789, "src": "4164:9:4", "typeDescriptions": { "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", "typeString": "function (bytes memory) pure returns (bytes32)" } }, "id": 803, "isConstant": false, "isLValue": false, "isPure": true, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "4164:51:4", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "visibility": "internal" }, { "constant": false, "id": 810, "name": "interfaces", "nodeType": "VariableDeclaration", "scope": 1210, "src": "4305:67:4", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_bytes32_$_t_address_$_$", "typeString": "mapping(address => mapping(bytes32 => address))" }, "typeName": { "id": 809, "keyType": { "id": 805, "name": "address", "nodeType": "ElementaryTypeName", "src": "4313:7:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "4305:47:4", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_bytes32_$_t_address_$_$", "typeString": "mapping(address => mapping(bytes32 => address))" }, "valueType": { "id": 808, "keyType": { "id": 806, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "4332:7:4", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "nodeType": "Mapping", "src": "4324:27:4", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_address_$", "typeString": "mapping(bytes32 => address)" }, "valueType": { "id": 807, "name": "address", "nodeType": "ElementaryTypeName", "src": "4343:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 814, "name": "managers", "nodeType": "VariableDeclaration", "scope": 1210, "src": "4435:45:4", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_address_$", "typeString": "mapping(address => address)" }, "typeName": { "id": 813, "keyType": { "id": 811, "name": "address", "nodeType": "ElementaryTypeName", "src": "4443:7:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "4435:27:4", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_address_$", "typeString": "mapping(address => address)" }, "valueType": { "id": 812, "name": "address", "nodeType": "ElementaryTypeName", "src": "4454:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 820, "name": "erc165Cached", "nodeType": "VariableDeclaration", "scope": 1210, "src": "4574:65:4", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_bytes4_$_t_bool_$_$", "typeString": "mapping(address => mapping(bytes4 => bool))" }, "typeName": { "id": 819, "keyType": { "id": 815, "name": "address", "nodeType": "ElementaryTypeName", "src": "4582:7:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "4574:43:4", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_bytes4_$_t_bool_$_$", "typeString": "mapping(address => mapping(bytes4 => bool))" }, "valueType": { "id": 818, "keyType": { "id": 816, "name": "bytes4", "nodeType": "ElementaryTypeName", "src": "4601:6:4", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" } }, "nodeType": "Mapping", "src": "4593:23:4", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes4_$_t_bool_$", "typeString": "mapping(bytes4 => bool)" }, "valueType": { "id": 817, "name": "bool", "nodeType": "ElementaryTypeName", "src": "4611:4:4", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } } }, "value": null, "visibility": "internal" }, { "anonymous": false, "documentation": "@notice Indicates a contract is the 'implementer' of 'interfaceHash' for 'addr'.", "id": 828, "name": "InterfaceImplementerSet", "nodeType": "EventDefinition", "parameters": { "id": 827, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 822, "indexed": true, "name": "addr", "nodeType": "VariableDeclaration", "scope": 828, "src": "4765:20:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 821, "name": "address", "nodeType": "ElementaryTypeName", "src": "4765:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 824, "indexed": true, "name": "interfaceHash", "nodeType": "VariableDeclaration", "scope": 828, "src": "4787:29:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 823, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "4787:7:4", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 826, "indexed": true, "name": "implementer", "nodeType": "VariableDeclaration", "scope": 828, "src": "4818:27:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 825, "name": "address", "nodeType": "ElementaryTypeName", "src": "4818:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "4764:82:4" }, "src": "4735:112:4" }, { "anonymous": false, "documentation": "@notice Indicates 'newManager' is the address of the new manager for 'addr'.", "id": 834, "name": "ManagerChanged", "nodeType": "EventDefinition", "parameters": { "id": 833, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 830, "indexed": true, "name": "addr", "nodeType": "VariableDeclaration", "scope": 834, "src": "4958:20:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 829, "name": "address", "nodeType": "ElementaryTypeName", "src": "4958:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 832, "indexed": true, "name": "newManager", "nodeType": "VariableDeclaration", "scope": 834, "src": "4980:26:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 831, "name": "address", "nodeType": "ElementaryTypeName", "src": "4980:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "4957:50:4" }, "src": "4937:71:4" }, { "body": { "id": 882, "nodeType": "Block", "src": "5731:338:4", "statements": [ { "assignments": [ 844 ], "declarations": [ { "constant": false, "id": 844, "name": "addr", "nodeType": "VariableDeclaration", "scope": 882, "src": "5741:12:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 843, "name": "address", "nodeType": "ElementaryTypeName", "src": "5741:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "id": 854, "initialValue": { "argumentTypes": null, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 849, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 845, "name": "_addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 836, "src": "5756:5:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 847, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "5773:1:4", "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": 846, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "5765:7:4", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 848, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "5765:10:4", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "5756:19:4", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseExpression": { "argumentTypes": null, "id": 852, "name": "_addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 836, "src": "5791:5:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 853, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "Conditional", "src": "5756:40:4", "trueExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 850, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2795, "src": "5778:3:4", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 851, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "5778:10:4", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "VariableDeclarationStatement", "src": "5741:55:4" }, { "condition": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 856, "name": "_interfaceHash", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 838, "src": "5828:14:4", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } ], "id": 855, "name": "isERC165Interface", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1192, "src": "5810:17:4", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$_t_bool_$", "typeString": "function (bytes32) pure returns (bool)" } }, "id": 857, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "5810:33:4", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 875, "nodeType": "IfStatement", "src": "5806:208:4", "trueBody": { "id": 874, "nodeType": "Block", "src": "5845:169:4", "statements": [ { "assignments": [ 859 ], "declarations": [ { "constant": false, "id": 859, "name": "erc165InterfaceHash", "nodeType": "VariableDeclaration", "scope": 874, "src": "5859:26:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" },