creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "contracts/DSyncDestraDNSResolverRX02.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\nimport \"./IDestraDNSRegistrarRX02.sol\";\nimport \"./IDestraDNSResolverRX02.sol\";\n\ncontract DSyncDestraDNSResolverRX02 is ReentrancyGuard, IDestraDNSResolverRX02 {\n  IDestraDNSRegistrarRX02 public registrar;\n\n  mapping(bytes32 => string) private contentHashes;\n\n  event ContentHashSet(string indexed domain, string indexed hash);\n\n  constructor(address _registrarAddress) {\n    require(_registrarAddress != address(0), \"Invalid registrar address\");\n    registrar = IDestraDNSRegistrarRX02(_registrarAddress);\n  }\n\n  function setContentHash(string memory _domain, string memory _hash) public {\n    (address owner, , ) = registrar.getDomainDetails(_domain);\n    require(msg.sender == owner, \"Caller is not the owner of the domain\");\n\n    bytes32 domainHash = keccak256(abi.encodePacked(_domain));\n    contentHashes[domainHash] = _hash;\n    emit ContentHashSet(_domain, _hash);\n  }\n\n  function getContentHash(\n    string memory _domain\n  ) public view returns (string memory) {\n    bytes32 domainHash = keccak256(abi.encodePacked(_domain));\n    return contentHashes[domainHash];\n  }\n}\n"
      },
      "contracts/IDestraDNSResolverRX02.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ninterface IDestraDNSResolverRX02 {\n  /**\n   * @dev Sets the content hash for a given domain.\n   * @param _domain The domain name for which the content hash is being set.\n   * @param _hash The content hash to assign to the domain.\n   * Only the owner of the domain can set the content hash.\n   */\n  function setContentHash(string memory _domain, string memory _hash) external;\n\n  /**\n   * @dev Retrieves the content hash associated with a given domain.\n   * @param _domain The domain name for which the content hash is being queried.\n   * @return The content hash of the domain.\n   */\n  function getContentHash(\n    string memory _domain\n  ) external view returns (string memory);\n}\n"
      },
      "contracts/IDestraDNSRegistrarRX02.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ninterface IDestraDNSRegistrarRX02 {\n  event DomainPurchased(\n    bytes32 indexed domainHash,\n    address indexed owner,\n    uint expiryDate\n  );\n\n  event DomainRenewed(bytes32 indexed domainHash, uint newExpiryDate);\n  event OwnershipTransferred(\n    bytes32 indexed domainHash,\n    address indexed oldOwner,\n    address indexed newOwner\n  );\n  event ResolverSet(\n    bytes32 indexed domainHash,\n    address indexed resolverAddress\n  );\n\n  event DomainOwnershipTransferQueued(\n    bytes32 indexed domainHash,\n    address indexed newOwner,\n    uint256 eta\n  );\n  event DomainOwnershipTransferCancelled(bytes32 indexed domainHash);\n\n  event ResolverApproved(address indexed resolverAddress, string tld);\n  event ResolverRevoked(address indexed resolverAddress);\n\n  event ReservationPhaseDurationUpdated(uint newDuration);\n  event ReservationExpiryDurationUpdated(uint newDuration);\n\n  event Withdrawal(address indexed to, uint256 amount);\n  event ProofOfSyncFactorySet(address indexed proofOfSyncFactory);\n  event TransferForeignToken(address token, uint256 amount);\n\n  /**\n   * @dev Sets the prices for domain registrations based on their length.\n   * @param lengths An array of domain lengths.\n   * @param prices Corresponding prices for each domain length.\n   */\n  function setPrices(\n    uint[] memory lengths,\n    uint[] memory prices,\n    uint maxLengthPrice\n  ) external;\n\n  /**\n   * @dev Retrieves the registration price for a given domain name based on its length.\n   * @param domain The domain name whose price is to be retrieved.\n   * @return The price for registering the given domain.\n   */\n  function getPrice(string memory domain) external view returns (uint);\n\n  /**\n   * @dev Reserves a domain by creating a hash reservation with the domain and a secret.\n   * @param reservationId A unique identifier for the reservation.\n   * @param hash The keccak256 hash of the domain and secret.\n   */\n  function reserveDomain(bytes32 reservationId, bytes32 hash) external;\n\n  /**\n   * @dev Generates a hash used for reserving a domain. This hash includes the domain name and a secret.\n   * @param domain The domain name to be hashed.\n   * @param secret A secret value to be hashed with the domain name.\n   * @return The resulting hash of the domain and secret.\n   */\n  function generateReservationsHash(\n    string memory domain,\n    string memory secret\n  ) external pure returns (bytes32);\n\n  /**\n   * @dev Registers a domain after a successful reservation and reservation phase.\n   * @param domain The domain name to register.\n   * @param _years The number of years to register the domain for.\n   * @param secret The secret used in the reservation hash.\n   * @param reservationId The unique identifier for the reservation.\n   */\n  function buyDomain(\n    string memory domain,\n    uint _years,\n    string memory secret,\n    bytes32 reservationId\n  ) external payable;\n\n  /**\n   * @dev Renews the registration of a domain.\n   * @param domain The domain name to renew.\n   * @param _years The number of additional years to renew the domain for.\n   */\n  function renewDomain(string memory domain, uint _years) external payable;\n\n  /**\n   * @dev Initiates the transfer of domain ownership to a new owner.\n   * @param domain The domain name whose ownership is to be transferred.\n   * @param newOwner The address of the new owner.\n   */\n  function initiateTransferOwnership(\n    string memory domain,\n    address newOwner\n  ) external;\n\n  /**\n   * @dev Completes the transfer of domain ownership after the unlock time.\n   * @param domain The domain name being transferred.\n   */\n  function completeTransferOwnership(string memory domain) external;\n\n  /**\n   * @dev Cancels a pending transfer request for a domain.\n   * @param domain The domain name whose transfer is to be cancelled.\n   */\n  function cancelTransferRequest(string memory domain) external;\n\n  /**\n   * @dev Approves a resolver address, allowing it to be used for domains.\n   * @param resolverAddress The address of the resolver to approve.\n   */\n  function approveResolver(string memory tld, address resolverAddress) external;\n\n  /**\n   * @dev Sets the resolver address for a domain.\n   * @param domain The domain name to set the resolver for.\n   * @param resolverAddress The address of the resolver.\n   */\n  function setResolver(\n    string memory domain,\n    address resolverAddress,\n    string memory tld\n  ) external;\n\n  /**\n   * @dev Checks if a domain is available for registration.\n   * @param domain The domain name to check availability for.\n   * @return True if the domain is available, false otherwise.\n   */\n  function isDomainAvailable(string memory domain) external view returns (bool);\n\n  /**\n   * @dev Retrieves details for a given domain.\n   * @param domain The domain name to query.\n   * @return owner The address of the domain owner.\n   * @return expiryDate The expiration date of the domain registration.\n   * @return resolverAddress The address of the domain resolver.\n   */\n  function getDomainDetails(\n    string memory domain\n  )\n    external\n    view\n    returns (address owner, uint expiryDate, address resolverAddress);\n\n  /**\n   * @dev Allows the contract owner to update the reservation phase duration.\n   * @param _reservationPhaseDuration The new duration in seconds.\n   */\n  function setReservationPhaseDuration(uint _reservationPhaseDuration) external;\n\n  /**\n   * @dev Allows the contract owner to update the reservation expiry duration.\n   * @param _reservationExpiryDuration The new expiry duration in seconds.\n   */\n  function setReservationExpiryDuration(\n    uint _reservationExpiryDuration\n  ) external;\n}\n"
      },
      "@openzeppelin/contracts/utils/ReentrancyGuard.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant NOT_ENTERED = 1;\n    uint256 private constant ENTERED = 2;\n\n    uint256 private _status;\n\n    /**\n     * @dev Unauthorized reentrant call.\n     */\n    error ReentrancyGuardReentrantCall();\n\n    constructor() {\n        _status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be NOT_ENTERED\n        if (_status == ENTERED) {\n            revert ReentrancyGuardReentrantCall();\n        }\n\n        // Any calls to nonReentrant after this point will fail\n        _status = ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _status == ENTERED;\n    }\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      }
    }
  }}