-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve merge conflict/auction (#25)
* feat: add Public Resolvers into testnet v0.2.0 (#17) * forge install: ens-contracts v0.1 * forge install: buffer 688aa09e9ad241a94609e6af539e65f229912b16 * chore: migrate from private repo * feat: add PublicResolver & dependency * fix: outdated name and address in Public Resolver (#5) fix: outdated name and address in Public Resolver * fix: resolve merge conflicts * fix: resolve merge conflicts --------- Co-authored-by: Duc Tho Tran <ducthotran2010@gmail.com> * feat: add RNSAuction --------- Co-authored-by: Duc Tho Tran <ducthotran2010@gmail.com>
- Loading branch information
1 parent
d030533
commit 4492422
Showing
30 changed files
with
1,139 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule ens-contracts
added at
0c75ba
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import { ERC165 } from "@openzeppelin/contracts/utils/introspection/ERC165.sol"; | ||
import { IMulticallable } from "@rns-contracts/interfaces/IMulticallable.sol"; | ||
import { ErrorHandler } from "@rns-contracts/libraries/ErrorHandler.sol"; | ||
|
||
abstract contract Multicallable is ERC165, IMulticallable { | ||
using ErrorHandler for bool; | ||
|
||
/** | ||
* @dev Override {IERC165-supportsInterface}. | ||
*/ | ||
function supportsInterface(bytes4 interfaceID) public view virtual override returns (bool) { | ||
return interfaceID == type(IMulticallable).interfaceId || super.supportsInterface(interfaceID); | ||
} | ||
|
||
/** | ||
* @inheritdoc IMulticallable | ||
*/ | ||
function multicall(bytes[] calldata data) public override returns (bytes[] memory results) { | ||
return _tryMulticall(true, data); | ||
} | ||
|
||
/** | ||
* @inheritdoc IMulticallable | ||
*/ | ||
function tryMulticall(bool requireSuccess, bytes[] calldata data) public override returns (bytes[] memory results) { | ||
return _tryMulticall(requireSuccess, data); | ||
} | ||
|
||
/** | ||
* @dev See {IMulticallable-tryMulticall}. | ||
*/ | ||
function _tryMulticall(bool requireSuccess, bytes[] calldata data) internal returns (bytes[] memory results) { | ||
uint256 length = data.length; | ||
results = new bytes[](length); | ||
|
||
bool success; | ||
bytes memory result; | ||
|
||
for (uint256 i; i < length;) { | ||
(success, result) = address(this).delegatecall(data[i]); | ||
if (requireSuccess) success.handleRevert(result); | ||
results[i] = result; | ||
|
||
unchecked { | ||
++i; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.0; | ||
|
||
/** | ||
* @notice To multi-call to a specified contract which has multicall interface: | ||
* | ||
* ```solidity | ||
* interface IMock is IMulticallable { | ||
* function foo() external; | ||
* function bar() external; | ||
* } | ||
* | ||
* bytes[] memory calldatas = new bytes[](2); | ||
* calldatas[0] = abi.encodeCall(IMock.foo,()); | ||
* calldatas[1] = abi.encodeCall(IMock.bar,()); | ||
* IMock(target).multicall(calldatas); | ||
* ``` | ||
*/ | ||
interface IMulticallable { | ||
/** | ||
* @dev Executes bulk action to the original contract. | ||
* Reverts if there is a single call failed. | ||
* | ||
* @param data The calldata to original contract. | ||
* | ||
*/ | ||
function multicall(bytes[] calldata data) external returns (bytes[] memory results); | ||
|
||
/** | ||
* @dev Executes bulk action to the original contract. | ||
* | ||
* @param requireSuccess Flag to indicating whether the contract reverts if there is a single call failed. | ||
* @param data The calldata to original contract. | ||
* | ||
*/ | ||
function tryMulticall(bool requireSuccess, bytes[] calldata data) external returns (bytes[] memory results); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.0; | ||
|
||
interface IABIResolver { | ||
/// Thrown when the input content type is invalid. | ||
error InvalidContentType(); | ||
|
||
/// @dev Emitted when the ABI is changed. | ||
event ABIChanged(bytes32 indexed node, uint256 indexed contentType); | ||
|
||
/** | ||
* @dev Sets the ABI associated with an INS node. Nodes may have one ABI of each content type. To remove an ABI, set it | ||
* to the empty string. | ||
* | ||
* Requirements: | ||
* - The method caller must be authorized to change user fields of RNS Token `node`. See indicator | ||
* {ModifyingIndicator.USER_FIELDS_INDICATOR}. | ||
* - The content type must be powers of 2. | ||
* | ||
* Emitted an event {ABIChanged}. | ||
* | ||
* @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; | ||
|
||
/** | ||
* @dev Returns the ABI associated with an INS node. | ||
* Defined in EIP-205, see more at https://eips.ethereum.org/EIPS/eip-205 | ||
* | ||
* @param node The INS 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 contentType, bytes memory data); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.0; | ||
|
||
interface IAddressResolver { | ||
/// @dev Emitted when an address of a node is changed. | ||
event AddrChanged(bytes32 indexed node, address addr); | ||
|
||
/** | ||
* @dev Sets the address associated with an INS node. | ||
* | ||
* Requirement: | ||
* - The method caller must be authorized to change user fields of RNS Token `node`. See indicator | ||
* {ModifyingIndicator.USER_FIELDS_INDICATOR}. | ||
* | ||
* Emits an event {AddrChanged}. | ||
* | ||
* @param node The node to update. | ||
* @param addr The address to set. | ||
*/ | ||
function setAddr(bytes32 node, address addr) external; | ||
|
||
/** | ||
* @dev Returns the address associated with an INS node. | ||
* @param node The INS node to query. | ||
* @return The associated address. | ||
*/ | ||
function addr(bytes32 node) external view returns (address payable); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
interface IContentHashResolver { | ||
/// @dev Emitted when the content hash of a node is changed. | ||
event ContentHashChanged(bytes32 indexed node, bytes hash); | ||
|
||
/** | ||
* @dev Sets the content hash associated with an INS node. | ||
* | ||
* Requirements: | ||
* - The method caller must be authorized to change user fields of RNS Token `node`. See indicator | ||
* {ModifyingIndicator.USER_FIELDS_INDICATOR}. | ||
* | ||
* Emits an event {ContentHashChanged}. | ||
* | ||
* @param node The node to update. | ||
* @param hash The content hash to set | ||
*/ | ||
function setContentHash(bytes32 node, bytes calldata hash) external; | ||
|
||
/** | ||
* @dev Returns the content hash associated with an INS node. | ||
* @param node The INS node to query. | ||
* @return The associated content hash. | ||
*/ | ||
function contentHash(bytes32 node) external view returns (bytes memory); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.4; | ||
|
||
interface IDNSRecordResolver { | ||
/// @dev Emitted whenever a given node/name/resource's RRSET is updated. | ||
event DNSRecordChanged(bytes32 indexed node, bytes name, uint16 resource, bytes record); | ||
/// @dev Emitted whenever a given node/name/resource's RRSET is deleted. | ||
event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource); | ||
|
||
/** | ||
* @dev 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. | ||
* | ||
* Requirements: | ||
* - The method caller must be authorized to change user fields of RNS Token `node`. See indicator | ||
* {ModifyingIndicator.USER_FIELDS_INDICATOR}. | ||
* | ||
* @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; | ||
|
||
/** | ||
* @dev 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) external view returns (bytes memory); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.4; | ||
|
||
interface IDNSZoneResolver { | ||
/// @dev Emitted whenever a given node's zone hash is updated. | ||
event DNSZonehashChanged(bytes32 indexed node, bytes lastzonehash, bytes zonehash); | ||
|
||
/** | ||
* @dev Sets the hash for the zone. | ||
* | ||
* Requirements: | ||
* - The method caller must be authorized to change user fields of RNS Token `node`. See indicator | ||
* {ModifyingIndicator.USER_FIELDS_INDICATOR}. | ||
* | ||
* Emits an event {DNSZonehashChanged}. | ||
* | ||
* @param node The node to update. | ||
* @param hash The zonehash to set | ||
*/ | ||
function setZonehash(bytes32 node, bytes calldata hash) external; | ||
|
||
/** | ||
* @dev Obtains the hash for the zone. | ||
* @param node The INS node to query. | ||
* @return The associated contenthash. | ||
*/ | ||
function zonehash(bytes32 node) external view returns (bytes memory); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
interface IInterfaceResolver { | ||
/// @dev Emitted when the interface of node is changed. | ||
event InterfaceChanged(bytes32 indexed node, bytes4 indexed interfaceID, address implementer); | ||
|
||
/** | ||
* @dev 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. | ||
* | ||
* Requirements: | ||
* - The method caller must be authorized to change user fields of RNS Token `node`. See indicator | ||
* {ModifyingIndicator.USER_FIELDS_INDICATOR}. | ||
* | ||
* @param node The node to update. | ||
* @param interfaceID The EIP 165 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; | ||
|
||
/** | ||
* @dev 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 EIP165 and returns `true` for | ||
* the specified interfaceID, its address will be returned. | ||
* | ||
* @param node The INS node to query. | ||
* @param interfaceID The EIP 165 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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
interface IPublicKeyResolver { | ||
struct PublicKey { | ||
bytes32 x; | ||
bytes32 y; | ||
} | ||
|
||
/// @dev Emitted when a node public key is changed. | ||
event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y); | ||
|
||
/** | ||
* @dev Sets the SECP256k1 public key associated with an INS node. | ||
* | ||
* Requirements: | ||
* - The method caller must be authorized to change user fields of RNS Token `node`. See indicator | ||
* {ModifyingIndicator.USER_FIELDS_INDICATOR}. | ||
* | ||
* Emits an event {PubkeyChanged}. | ||
* | ||
* @param node The INS 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; | ||
|
||
/** | ||
* @dev Returns the SECP256k1 public key associated with an INS node. | ||
* Defined in EIP 619. | ||
* | ||
* @param node The INS node to query | ||
* @return x The X coordinate of the curve point for the public key. | ||
* @return y The Y coordinate of the curve point for the public key. | ||
*/ | ||
function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y); | ||
} |
Oops, something went wrong.