resolve()method that permits more flexible handling of name resolution.
CREATE2addresses), to designated "fallback" addresses, or other schemes. Additionally, individual resolvers would still be assignable to any given subdomain, which would supersede the wildcard resolution using the parent resolver.
namehashbe the algorithm defined in ENSIP-1.
dnsencodebe the process for encoding DNS names specified in section 3.1 of RFC1035, with the exception that there is no limit on the total length of the encoded name. The empty string is encoded identically to the name '.', as a single 0-octet.
parentbe a function that removes the first label from a name (eg,
parent('foo.eth') = 'eth').
parent('tld')is defined as the empty string ''.
ensis the ENS registry contract for the current network.
supportsInterface()is called on it with the interface's ID,
resolvewith the DNS-encoded name to resolve and the encoded calldata for a resolver function (as specified in ENSIP-1 and elsewhere); the function MUST either return valid return data for that function, or revert if it is not supported.
currentname = name
resolver = ens.resolver(namehash(currentname))
resolveris not the zero address, halt and return
currentnameis the empty name ('' or '.'), halt and return null.
currentname = parent(currentname)and go to 2.
calldatato the ABI-encoded call data for the resolution function required - for example, the ABI encoding of
addr(namehash(name))when resolving the
supportsENSIP10 = resolver.supportsInterface('0x9061b923').
supportsENSIP10is true, set
result = resolver.resolve(dnsencode(name), calldata)
supportsENSIP10is false and
name == currentname, set
resultto the result of calling
resultafter decoding it using the return data ABI of the corresponding resolution function (eg, for
addr(), ABI-decode the result of
addr()etc) and the
resolvefunction are supplied the original
name, not the
currentnamefound in the first stage of resolution.
name != currentname), clients MUST NOT call legacy methods such as
addrto resolve the name. These methods may only be called on resolvers set on an exact match for
resolvefunction for resolvers, taking the unhashed name and calldata for a resolution function increases implementation complexity, it provides a means for resolvers to obtain plaintext labels and act accordingly, which enables many wildcard-related use-cases that would otherwise not be possible - for example, a wildcard resolver could resolve
id.nifty.ethto the owner of the NFT with id
idin some collection. With only namehashes to work with, this is not possible.
resolvefunction for non-wildcard use-cases (eg, where the resolver is set directly on the name being resolved) should consider what to return to legacy clients that call the individual resolution functions for maximum compatibility.
addretc) on wildcard resolvers prevents inadvertant backwards compatiability issues with resolvers that answer queries for all names.