Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.] String Resolver #116

Open
wants to merge 20 commits into
base: rc/zns-meowchain
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
280 changes: 140 additions & 140 deletions contracts/registrar/IZNSSubRegistrar.sol
Original file line number Diff line number Diff line change
@@ -1,140 +1,140 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import { IDistributionConfig } from "../types/IDistributionConfig.sol";
import { PaymentConfig } from "../treasury/IZNSTreasury.sol";
import { IZNSPricer } from "../types/IZNSPricer.sol";

/**
* @title IZNSSubRegistrar.sol - Interface for the ZNSSubRegistrar contract responsible for registering subdomains.
*/
interface IZNSSubRegistrar is IDistributionConfig {
/**
* @notice Reverted when someone other than parent owner is trying to buy
a subdomain under the parent that is locked\
* or when the parent provided does not exist.
*/
error ParentLockedOrDoesntExist(bytes32 parentHash);

/**
* @notice Reverted when the buyer of subdomain is not approved by the parent in it's mintlist.
*/
error SenderNotApprovedForPurchase(bytes32 parentHash, address sender);

/**
* @notice Emitted when a new `DistributionConfig.pricerContract` is set for a domain.
*/
event PricerContractSet(
bytes32 indexed domainHash,
address indexed pricerContract
);

/**
* @notice Emitted when a new `DistributionConfig.paymentType` is set for a domain.
*/
event PaymentTypeSet(bytes32 indexed domainHash, PaymentType paymentType);

/**
* @notice Emitted when a new `DistributionConfig.accessType` is set for a domain.
*/
event AccessTypeSet(bytes32 indexed domainHash, AccessType accessType);

/**
* @notice Emitted when a new full `DistributionConfig` is set for a domain at once.
*/
event DistributionConfigSet(
bytes32 indexed domainHash,
IZNSPricer pricerContract,
PaymentType paymentType,
AccessType accessType
);

/**
* @notice Emitted when a `mintlist` is updated for a domain.
*/
event MintlistUpdated(
bytes32 indexed domainHash,
uint256 indexed ownerIndex,
address[] candidates,
bool[] allowed
);

/*
* @notice Emitted when a `mintlist` is removed for a domain by the owner or through
* `ZNSRootRegistrar.revokeDomain()`.
*/
event MintlistCleared(bytes32 indexed domainHash);

/**
* @notice Emitted when the ZNSRootRegistrar address is set in state.
*/
event RootRegistrarSet(address registrar);

function distrConfigs(
bytes32 domainHash
)
external view returns (
IZNSPricer pricerContract,
PaymentType paymentType,
AccessType accessType
);

function isMintlistedForDomain(
bytes32 domainHash,
address candidate
) external view returns (bool);

function initialize(
address _accessController,
address _registry,
address _rootRegistrar
) external;

function registerSubdomain(
bytes32 parentHash,
string calldata label,
address domainAddress,
string calldata tokenURI,
DistributionConfig calldata configForSubdomains,
PaymentConfig calldata paymentConfig
) external returns (bytes32);

function hashWithParent(
bytes32 parentHash,
string calldata label
) external pure returns (bytes32);

function setDistributionConfigForDomain(
bytes32 parentHash,
DistributionConfig calldata config
) external;

function setPricerContractForDomain(
bytes32 domainHash,
IZNSPricer pricerContract
) external;

function setPaymentTypeForDomain(
bytes32 domainHash,
PaymentType paymentType
) external;

function setAccessTypeForDomain(
bytes32 domainHash,
AccessType accessType
) external;

function updateMintlistForDomain(
bytes32 domainHash,
address[] calldata candidates,
bool[] calldata allowed
) external;

function clearMintlistForDomain(bytes32 domainHash) external;

function clearMintlistAndLock(bytes32 domainHash) external;

function setRegistry(address registry_) external;

function setRootRegistrar(address registrar_) external;
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
import { IDistributionConfig } from "../types/IDistributionConfig.sol";
import { PaymentConfig } from "../treasury/IZNSTreasury.sol";
import { IZNSPricer } from "../types/IZNSPricer.sol";
/**
* @title IZNSSubRegistrar.sol - Interface for the ZNSSubRegistrar contract responsible for registering subdomains.
*/
interface IZNSSubRegistrar is IDistributionConfig {
/**
* @notice Reverted when someone other than parent owner is trying to buy
* a subdomain under the parent that is locked
* or when the parent provided does not exist.
*/
error ParentLockedOrDoesntExist(bytes32 parentHash);
/**
* @notice Reverted when the buyer of subdomain is not approved by the parent in it's mintlist.
*/
error SenderNotApprovedForPurchase(bytes32 parentHash, address sender);
/**
* @notice Emitted when a new `DistributionConfig.pricerContract` is set for a domain.
*/
event PricerContractSet(
bytes32 indexed domainHash,
address indexed pricerContract
);
/**
* @notice Emitted when a new `DistributionConfig.paymentType` is set for a domain.
*/
event PaymentTypeSet(bytes32 indexed domainHash, PaymentType paymentType);
/**
* @notice Emitted when a new `DistributionConfig.accessType` is set for a domain.
*/
event AccessTypeSet(bytes32 indexed domainHash, AccessType accessType);
/**
* @notice Emitted when a new full `DistributionConfig` is set for a domain at once.
*/
event DistributionConfigSet(
bytes32 indexed domainHash,
IZNSPricer pricerContract,
PaymentType paymentType,
AccessType accessType
);
/**
* @notice Emitted when a `mintlist` is updated for a domain.
*/
event MintlistUpdated(
bytes32 indexed domainHash,
uint256 indexed ownerIndex,
address[] candidates,
bool[] allowed
);
/*
* @notice Emitted when a `mintlist` is removed for a domain by the owner or through
* `ZNSRootRegistrar.revokeDomain()`.
*/
event MintlistCleared(bytes32 indexed domainHash);
/**
* @notice Emitted when the ZNSRootRegistrar address is set in state.
*/
event RootRegistrarSet(address registrar);
function distrConfigs(
bytes32 domainHash
) external view returns (
IZNSPricer pricerContract,
PaymentType paymentType,
AccessType accessType
);
function isMintlistedForDomain(
bytes32 domainHash,
address candidate
) external view returns (bool);
function initialize(
address _accessController,
address _registry,
address _rootRegistrar
) external;
function registerSubdomain(
bytes32 parentHash,
string calldata label,
address domainAddress,
string calldata tokenURI,
DistributionConfig calldata configForSubdomains,
PaymentConfig calldata paymentConfig
) external returns (bytes32);
function hashWithParent(
bytes32 parentHash,
string calldata label
) external pure returns (bytes32);
function setDistributionConfigForDomain(
bytes32 parentHash,
DistributionConfig calldata config
) external;
function setPricerContractForDomain(
bytes32 domainHash,
IZNSPricer pricerContract
) external;
function setPaymentTypeForDomain(
bytes32 domainHash,
PaymentType paymentType
) external;
function setAccessTypeForDomain(
bytes32 domainHash,
AccessType accessType
) external;
function updateMintlistForDomain(
bytes32 domainHash,
address[] calldata candidates,
bool[] calldata allowed
) external;
function clearMintlistForDomain(bytes32 domainHash) external;
function clearMintlistAndLock(bytes32 domainHash) external;
function setRegistry(address registry_) external;
function setRootRegistrar(address registrar_) external;
}
26 changes: 26 additions & 0 deletions contracts/resolver/IZNSStringResolver.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;


interface IZNSStringResolver {
/**
* @param domainHash The identifying hash of a domain's name
* @param newString - content of string type set by the owner/operator to which a domain will resolve to
*/
event StringSet(bytes32 indexed domainHash, string indexed newString);

function supportsInterface(bytes4 interfaceId) external view returns (bool);

function resolveDomainString(bytes32 domainHash) external view returns (string memory);

function setString(
bytes32 domainHash,
string calldata newString
) external;

function getInterfaceId() external pure returns (bytes4);

function setRegistry(address _registry) external;

function initialize(address _accessController, address _registry) external;
}
Loading