status-go/contracts/resolver/resolver.sol

556 lines
18 KiB
Solidity
Raw Permalink Normal View History

// This solidity file was added to the project to generate the ABI to consume
// the smart contract deployed at 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e
2021-12-21 15:05:09 +00:00
pragma solidity >=0.4.24;
interface ENS {
// Logged when the owner of a node assigns a new owner to a subnode.
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
// Logged when the owner of a node transfers ownership to a new account.
event Transfer(bytes32 indexed node, address owner);
// Logged when the resolver for a node changes.
event NewResolver(bytes32 indexed node, address resolver);
// Logged when the TTL of a node changes
event NewTTL(bytes32 indexed node, uint64 ttl);
// Logged when an operator is added or removed.
event ApprovalForAll(
address indexed owner,
address indexed operator,
bool approved
);
function setRecord(
bytes32 node,
address owner,
address resolver,
uint64 ttl
) external;
function setSubnodeRecord(
bytes32 node,
bytes32 label,
address owner,
address resolver,
uint64 ttl
) external;
function setSubnodeOwner(
bytes32 node,
bytes32 label,
address owner
) external returns (bytes32);
2021-12-21 15:05:09 +00:00
function setResolver(bytes32 node, address resolver) external;
2021-12-21 15:05:09 +00:00
function setOwner(bytes32 node, address owner) external;
2021-12-21 15:05:09 +00:00
function setTTL(bytes32 node, uint64 ttl) external;
2021-12-21 15:05:09 +00:00
function setApprovalForAll(address operator, bool approved) external;
2021-12-21 15:05:09 +00:00
function owner(bytes32 node) external view returns (address);
2021-12-21 15:05:09 +00:00
function resolver(bytes32 node) external view returns (address);
2021-12-21 15:05:09 +00:00
function ttl(bytes32 node) external view returns (uint64);
2021-12-21 15:05:09 +00:00
function recordExists(bytes32 node) external view returns (bool);
function isApprovedForAll(address owner, address operator)
external
view
returns (bool);
2021-12-21 15:05:09 +00:00
}
/**
* The ENS registry contract.
*/
contract ENSRegistry is ENS {
struct Record {
address owner;
address resolver;
uint64 ttl;
}
/**
* @dev Sets the record for a node.
* @param node The node to update.
* @param owner The address of the new owner.
* @param resolver The address of the resolver.
* @param ttl The TTL in seconds.
*/
function setRecord(
bytes32 node,
address owner,
address resolver,
uint64 ttl
) external;
2021-12-21 15:05:09 +00:00
/**
* @dev Sets the record for a subnode.
* @param node The parent node.
* @param label The hash of the label specifying the subnode.
* @param owner The address of the new owner.
* @param resolver The address of the resolver.
* @param ttl The TTL in seconds.
*/
function setSubnodeRecord(
bytes32 node,
bytes32 label,
address owner,
address resolver,
uint64 ttl
) external;
2021-12-21 15:05:09 +00:00
/**
* @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.
* @param node The node to transfer ownership of.
* @param owner The address of the new owner.
*/
function setOwner(bytes32 node, address owner) public;
2021-12-21 15:05:09 +00:00
/**
* @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.
* @param node The parent node.
* @param label The hash of the label specifying the subnode.
* @param owner The address of the new owner.
*/
function setSubnodeOwner(
bytes32 node,
bytes32 label,
address owner
) public returns (bytes32);
2021-12-21 15:05:09 +00:00
/**
* @dev Sets the resolver address for the specified node.
* @param node The node to update.
* @param resolver The address of the resolver.
*/
function setResolver(bytes32 node, address resolver) public;
2021-12-21 15:05:09 +00:00
/**
* @dev Sets the TTL for the specified node.
* @param node The node to update.
* @param ttl The TTL in seconds.
*/
function setTTL(bytes32 node, uint64 ttl) public;
2021-12-21 15:05:09 +00:00
/**
* @dev Enable or disable approval for a third party ("operator") to manage
* all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.
* @param operator Address to add to the set of authorized operators.
* @param approved True if the operator is approved, false to revoke approval.
*/
function setApprovalForAll(address operator, bool approved) external;
2021-12-21 15:05:09 +00:00
/**
* @dev Returns the address that owns the specified node.
* @param node The specified node.
* @return address of the owner.
*/
function owner(bytes32 node) public view returns (address);
2021-12-21 15:05:09 +00:00
/**
* @dev Returns the address of the resolver for the specified node.
* @param node The specified node.
* @return address of the resolver.
*/
function resolver(bytes32 node) public view returns (address);
2021-12-21 15:05:09 +00:00
/**
* @dev Returns the TTL of a node, and any records associated with it.
* @param node The specified node.
* @return ttl of the node.
*/
function ttl(bytes32 node) public view returns (uint64);
2021-12-21 15:05:09 +00:00
/**
* @dev Returns whether a record has been imported to the registry.
* @param node The specified node.
* @return Bool if record exists
*/
function recordExists(bytes32 node) public view returns (bool);
2021-12-21 15:05:09 +00:00
/**
* @dev Query if an address is an authorized operator for another address.
* @param owner The address that owns the records.
* @param operator The address that acts on behalf of the owner.
* @return True if `operator` is an approved operator for `owner`, false otherwise.
*/
function isApprovedForAll(address owner, address operator)
external
view
returns (bool);
2021-12-21 15:05:09 +00:00
}
/**
* The ENS registry contract.
*/
contract ENSRegistryWithFallback is ENSRegistry {
/**
* @dev Returns the address of the resolver for the specified node.
* @param node The specified node.
* @return address of the resolver.
*/
function resolver(bytes32 node) public view returns (address);
2021-12-21 15:05:09 +00:00
/**
* @dev Returns the address that owns the specified node.
* @param node The specified node.
* @return address of the owner.
*/
function owner(bytes32 node) public view returns (address);
2021-12-21 15:05:09 +00:00
/**
* @dev Returns the TTL of a node, and any records associated with it.
* @param node The specified node.
* @return ttl of the node.
*/
function ttl(bytes32 node) public view returns (uint64);
2021-12-21 15:05:09 +00:00
}
contract ResolverBase {
function supportsInterface(bytes4 interfaceID) public pure returns (bool);
2021-12-21 15:05:09 +00:00
}
contract ABIResolver is ResolverBase {
event ABIChanged(bytes32 indexed node, uint256 indexed contentType);
/**
* Sets the ABI associated with an ENS node.
* Nodes may have one ABI of each content type. To remove an ABI, set it to
* the empty string.
* @param node The node to update.
* @param contentType The content type of the ABI
* @param data The ABI data.
*/
function setABI(
bytes32 node,
uint256 contentType,
bytes calldata data
) external;
2021-12-21 15:05:09 +00:00
/**
* Returns the ABI associated with an ENS node.
* Defined in EIP205.
* @param node The ENS node to query
* @param contentTypes A bitwise OR of the ABI formats accepted by the caller.
* @return contentType The content type of the return value
* @return data The ABI data
*/
function ABI(bytes32 node, uint256 contentTypes)
external
view
returns (uint256, bytes memory);
2021-12-21 15:05:09 +00:00
function supportsInterface(bytes4 interfaceID) public pure returns (bool);
2021-12-21 15:05:09 +00:00
}
contract AddrResolver is ResolverBase {
event AddrChanged(bytes32 indexed node, address a);
event AddressChanged(
bytes32 indexed node,
uint256 coinType,
bytes newAddress
);
2021-12-21 15:05:09 +00:00
/**
* Sets the address associated with an ENS node.
* May only be called by the owner of that node in the ENS registry.
* @param node The node to update.
* @param a The address to set.
*/
function setAddr(bytes32 node, address a) external;
2021-12-21 15:05:09 +00:00
/**
* Returns the address associated with an ENS node.
* @param node The ENS node to query.
* @return The associated address.
*/
function addr(bytes32 node) public view returns (address payable);
2021-12-21 15:05:09 +00:00
function setAddr(
bytes32 node,
uint256 coinType,
bytes memory a
) public;
2021-12-21 15:05:09 +00:00
function addr(bytes32 node, uint256 coinType)
public
view
returns (bytes memory);
2021-12-21 15:05:09 +00:00
function supportsInterface(bytes4 interfaceID) public pure returns (bool);
2021-12-21 15:05:09 +00:00
}
contract ContentHashResolver is ResolverBase {
event ContenthashChanged(bytes32 indexed node, bytes hash);
/**
* Sets the contenthash associated with an ENS node.
* May only be called by the owner of that node in the ENS registry.
* @param node The node to update.
* @param hash The contenthash to set
*/
function setContenthash(bytes32 node, bytes calldata hash) external;
2021-12-21 15:05:09 +00:00
/**
* Returns the contenthash associated with an ENS node.
* @param node The ENS node to query.
* @return The associated contenthash.
*/
function contenthash(bytes32 node) external view returns (bytes memory);
2021-12-21 15:05:09 +00:00
function supportsInterface(bytes4 interfaceID) public pure returns (bool);
2021-12-21 15:05:09 +00:00
}
contract DNSResolver is ResolverBase {
// DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.
event DNSRecordChanged(
bytes32 indexed node,
bytes name,
uint16 resource,
bytes record
);
2021-12-21 15:05:09 +00:00
// DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.
event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);
// DNSZoneCleared is emitted whenever a given node's zone information is cleared.
event DNSZoneCleared(bytes32 indexed node);
/**
* Set one or more DNS records. Records are supplied in wire-format.
* Records with the same node/name/resource must be supplied one after the
* other to ensure the data is updated correctly. For example, if the data
* was supplied:
* a.example.com IN A 1.2.3.4
* a.example.com IN A 5.6.7.8
* www.example.com IN CNAME a.example.com.
* then this would store the two A records for a.example.com correctly as a
* single RRSET, however if the data was supplied:
* a.example.com IN A 1.2.3.4
* www.example.com IN CNAME a.example.com.
* a.example.com IN A 5.6.7.8
* then this would store the first A record, the CNAME, then the second A
* record which would overwrite the first.
*
* @param node the namehash of the node for which to set the records
* @param data the DNS wire format records to set
*/
function setDNSRecords(bytes32 node, bytes calldata data) external;
2021-12-21 15:05:09 +00:00
/**
* Obtain a DNS record.
* @param node the namehash of the node for which to fetch the record
* @param name the keccak-256 hash of the fully-qualified name for which to fetch the record
* @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types
* @return the DNS record in wire format if present, otherwise empty
*/
function dnsRecord(
bytes32 node,
bytes32 name,
uint16 resource
) public view returns (bytes memory);
2021-12-21 15:05:09 +00:00
/**
* Check if a given node has records.
* @param node the namehash of the node for which to check the records
* @param name the namehash of the node for which to check the records
*/
function hasDNSRecords(bytes32 node, bytes32 name)
public
view
returns (bool);
2021-12-21 15:05:09 +00:00
/**
* Clear all information for a DNS zone.
* @param node the namehash of the node for which to clear the zone
*/
function clearDNSZone(bytes32 node) public;
2021-12-21 15:05:09 +00:00
function supportsInterface(bytes4 interfaceID) public pure returns (bool);
2021-12-21 15:05:09 +00:00
}
contract InterfaceResolver is ResolverBase, AddrResolver {
event InterfaceChanged(
bytes32 indexed node,
bytes4 indexed interfaceID,
address implementer
);
2021-12-21 15:05:09 +00:00
/**
* Sets an interface associated with a name.
* Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.
* @param node The node to update.
* @param interfaceID The EIP 168 interface ID.
* @param implementer The address of a contract that implements this interface for this node.
*/
function setInterface(
bytes32 node,
bytes4 interfaceID,
address implementer
) external;
2021-12-21 15:05:09 +00:00
/**
* Returns the address of a contract that implements the specified interface for this name.
* If an implementer has not been set for this interfaceID and name, the resolver will query
* the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that
* contract implements EIP168 and returns `true` for the specified interfaceID, its address
* will be returned.
* @param node The ENS node to query.
* @param interfaceID The EIP 168 interface ID to check for.
* @return The address that implements this interface, or 0 if the interface is unsupported.
*/
function interfaceImplementer(bytes32 node, bytes4 interfaceID)
external
view
returns (address);
2021-12-21 15:05:09 +00:00
function supportsInterface(bytes4 interfaceID) public pure returns (bool);
2021-12-21 15:05:09 +00:00
}
contract NameResolver is ResolverBase {
event NameChanged(bytes32 indexed node, string name);
/**
* Sets the name associated with an ENS node, for reverse records.
* May only be called by the owner of that node in the ENS registry.
* @param node The node to update.
* @param name The name to set.
*/
function setName(bytes32 node, string calldata name) external;
2021-12-21 15:05:09 +00:00
/**
* Returns the name associated with an ENS node, for reverse records.
* Defined in EIP181.
* @param node The ENS node to query.
* @return The associated name.
*/
function name(bytes32 node) external view returns (string memory);
2021-12-21 15:05:09 +00:00
function supportsInterface(bytes4 interfaceID) public pure returns (bool);
2021-12-21 15:05:09 +00:00
}
contract PubkeyResolver is ResolverBase {
event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);
struct PublicKey {
bytes32 x;
bytes32 y;
}
/**
* Sets the SECP256k1 public key associated with an ENS node.
* @param node The ENS node to query
* @param x the X coordinate of the curve point for the public key.
* @param y the Y coordinate of the curve point for the public key.
*/
function setPubkey(
bytes32 node,
bytes32 x,
bytes32 y
) external;
2021-12-21 15:05:09 +00:00
/**
* Returns the SECP256k1 public key associated with an ENS node.
* Defined in EIP 619.
* @param node The ENS node to query
* @return x, y the X and Y coordinates of the curve point for the public key.
*/
function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);
2021-12-21 15:05:09 +00:00
function supportsInterface(bytes4 interfaceID) public pure returns (bool);
2021-12-21 15:05:09 +00:00
}
contract TextResolver is ResolverBase {
event TextChanged(
bytes32 indexed node,
string indexed indexedKey,
string key
);
2021-12-21 15:05:09 +00:00
/**
* Sets the text data associated with an ENS node and key.
* May only be called by the owner of that node in the ENS registry.
* @param node The node to update.
* @param key The key to set.
* @param value The text data value to set.
*/
function setText(
bytes32 node,
string calldata key,
string calldata value
) external;
2021-12-21 15:05:09 +00:00
/**
* Returns the text data associated with an ENS node and key.
* @param node The ENS node to query.
* @param key The text data key to query.
* @return The associated text data.
*/
function text(bytes32 node, string calldata key)
external
view
returns (string memory);
2021-12-21 15:05:09 +00:00
function supportsInterface(bytes4 interfaceID) public pure returns (bool);
2021-12-21 15:05:09 +00:00
}
pragma experimental ABIEncoderV2;
/**
* A simple resolver anyone can use; only allows the owner of a node to set its
* address.
*/
contract PublicResolver is
ABIResolver,
AddrResolver,
ContentHashResolver,
DNSResolver,
InterfaceResolver,
NameResolver,
PubkeyResolver,
TextResolver
{
2021-12-21 15:05:09 +00:00
/**
* A mapping of authorisations. An address that is authorised for a name
* may make any changes to the name that the owner could, but may not update
* the set of authorisations.
* (node, owner, caller) => isAuthorised
*/
mapping(bytes32 => mapping(address => mapping(address => bool)))
public authorisations;
2021-12-21 15:05:09 +00:00
event AuthorisationChanged(
bytes32 indexed node,
address indexed owner,
address indexed target,
bool isAuthorised
);
2021-12-21 15:05:09 +00:00
/**
* @dev Sets or clears an authorisation.
* Authorisations are specific to the caller. Any account can set an authorisation
* for any name, but the authorisation that is checked will be that of the
* current owner of a name. Thus, transferring a name effectively clears any
* existing authorisations, and new authorisations can be set in advance of
* an ownership transfer if desired.
*
* @param node The name to change the authorisation on.
* @param target The address that is to be authorised or deauthorised.
* @param isAuthorised True if the address should be authorised, or false if it should be deauthorised.
*/
function setAuthorisation(
bytes32 node,
address target,
bool isAuthorised
) external;
2021-12-21 15:05:09 +00:00
function multicall(bytes[] calldata data)
external
returns (bytes[] memory results);
}